A jQuery/Zepto plugin I’ve been using a lot lately to debounce (= attach with delay) event handlers. To be applied on scroll
events for example, as you don’t want one long single scroll to pull down the performance of your webpage by constantly triggering the attached handling function.
$(window).on('scroll', function(e) {
// update stuff *after* the scroll
}, 250);
I prefer jquery.unevent.js
over this jQuery#debounce() for example as jquery.unevent.js
extends jquery#on()
with a simple third timing parameter.
jquery.unevent.js (demo) →
jquery.unevent.js (source) →
Yes, I know: a repost. It’s just that good!
Leave a comment