Possible Duplicate:
Javascript: do an action after user is done scrolling
the Scroll
event fires when the user starts scrolling the page, right? How to know if he is finished then? I want to call a function after the scrolling has done. Does anyone has any idea?
Thanks!
P.S. With jQuery please, but pure JS is also okay.
scrollTop - elem. clientHeight; It calculates distance scroll bar to bottom of element. Equal 0, if scroll bar has reached bottom.
The scroll event occurs when the user scrolls in the specified element. The scroll event works for all scrollable elements and the window object (browser window). The scroll() method triggers the scroll event, or attaches a function to run when a scroll event occurs.
You can achieve this using setTimeout
. you can change timeout (im using 100) value according to your requirement.
var timeoutId;
$(selector).scroll(function(){
if(timeoutId ){
clearTimeout(timeoutId );
}
timeoutId = setTimeout(function(){
// your code
}, 100);
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With