Why wont this work in IE, if I move the scroll bar to the middle then Refresh it will not reset to zero, instead it stays where is was last left?
$(document).ready(function(){
$(window).scrollLeft(0);
});
Thanks
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
This script should work as you need
As you find out, the behaviour of IE is different. It triggers
scrollevent even afterdocument.ready. This script will hook up on this event andscrollLeft(0)after refresh (in all browsers).The complicated part is, how to solve new comers, when user visits the page for a first time. Then Internet Explorer does not fire
scrollevent. And our handler is still in play (and would scroll left when user first time scroll right).We have to unbind
scrollLeftmanually. That’s why after 150ms is the handler unbounded anyway.