jquery.unevent.js

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!

Elsewhere , , , ,

One Response to jquery.unevent.js

  1. Pingback: rafscroll – chain your scroll events to requestAnimationFrame | Bram.us

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.