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!

Published by Bramus!

Bramus is a frontend web developer from Belgium, working as a Chrome Developer Relations Engineer at Google. From the moment he discovered view-source at the age of 14 (way back in 1997), he fell in love with the web and has been tinkering with it ever since (more …)

Join the Conversation

1 Comment

Leave a comment

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.