Last active
December 25, 2015 05:49
-
-
Save kmaida/6927580 to your computer and use it in GitHub Desktop.
jQuery resize() debounce
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function resizedFn(){ | |
// Haven't resized in 200ms! | |
// Run this code | |
} | |
var debounceResize; | |
$(window).resize(function(){ | |
clearTimeout(debounceResize); | |
debounceResize = setTimeout(resizedFn, 200); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment