0

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.

0

1 Answer 1

1

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.

Not the answer you're looking for? Browse other questions tagged or ask your own question.