Reputation: 9662
I am designing an horizontal navigation/layout site, where my articles are loaded one next to another instead of one below the other. The problem I have is that when I scroll horizontally the page (scrollLeft value is greater than 0) and I refresh the page, at first scrollLeft value is 0 (which means it is at the very left side), but when the page is finished loading ( $(window).load(); ) it scrolls automatically to the scrollLeft value it was before reloading. I have tried using
$(window).load(function() {
$('body').animate({scrollLeft: 0});
});
which works. But I would like to find another solution, as I want to start scrolling to the right while the page is loading and prevent it to send me back to the left as it finishes loading. I hope I made myself clear.
Thank you very much.
Upvotes: 0
Views: 295
Reputation: 9662
Ok, I figured it out. The problem was my scroll div was the 'html' (main) element. To solve it I just used another div (inside the html element,obviously) as the scroll div.
Upvotes: 1