Is there any way to prevent firing onscroll event when setting scrollTop property?
var a = $(".elem");
a.scrollTop(100); // will fire onScroll
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 code is kind of hackish but it gets the job done:
A basic assumption that we all seem to make is that the events will run at the same time, but on closer inspection we realize that Javascript runs on a single thread, meaning they will not run simultaneously. The commented out lock functionality is therefore useless. If you’re just trying to synchronize scrolling, the above code should work fine, but I’m honestly not too sure how to proceed from there.