Skip to content

Instantly share code, notes, and snippets.

@tristanm
Created September 16, 2012 20:41
Show Gist options
  • Save tristanm/3734311 to your computer and use it in GitHub Desktop.
Save tristanm/3734311 to your computer and use it in GitHub Desktop.
jQuery Debouncer
var debounce_timer = null;
$(window).resize(function(e) {
window.clearTimeout(debounce_timer);
debounce_timer = window.setTimeout(function() {
$(document).trigger("gh:resize");
}, 200);
});
$(document).on("gh:resize", function(e) {
console.log("resized!");
});
@faceleg
Copy link

faceleg commented Apr 25, 2014

This is great!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment