Scroll event
var scrollTimeout; // global for any pending scrollTimeout
$(window).on('scroll', function () {
if (scrollTimeout) {
// clear the timeout, if one is pending
clearTimeout(scrollTimeout);
scrollTimeout = null;
}
scrollTimeout = setTimeout(scrollHandler, 250);
});
scrollHandler = function () {
// Do something
};