var delayedExec = function(after, fn) {
var timer;
return function() {
timer && clearTimeout(timer);
timer = setTimeout(fn, after);
};
};
var scrollStopper = delayedExec(500, function() {
console.log('stopped it');
});
window.addEventListener('scroll', scrollStopper);
A snippet to fire an event with javascript when the user stops scrolling. I did not create this snipped, I just copied it for future use from stackoverflow ( http://stackoverflow.com/questions/3701311/event-when-user-stops-scrolling)....so, in short, credit where credit is due.
1 Response
The example is with resize-event, but the same can be applied to scroll...
Write a comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.