If i want to bind an event on page scrolling i can use scroll();.
But how to fire when scroll() is ended up?
I would like to reproduce this:
$(window).scroll(function(){
//do somenthing
});
$(window).scrollSTOPPED(function(){ //--> when i'm scrolling then i stop to scrolling (so NOT when page scrollbar is at the end top or bottom :)
//do somenthing else
});
any ideas?
tiny jquery way
After 250 ms from the last scroll event, this will invoke the “scrollStopped” callback.
http://jsfiddle.net/wtRrV/256/
lodash (even smaller)
http://jsfiddle.net/hotw1o2j/
pure js (technically the smallest)
https://jsfiddle.net/kpsxdcv8/15/
strange fact
clearTimeout and clearInterval params don’t have to be defined and can even be wrong types or even omitted.
http://jsfiddle.net/2w5zLwvx/