Skip to content

Instantly share code, notes, and snippets.

@thomasmb
Last active June 11, 2022 16:04
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thomasmb/92abf82e1ea1a251c93f57a6034f00d6 to your computer and use it in GitHub Desktop.
Save thomasmb/92abf82e1ea1a251c93f57a6034f00d6 to your computer and use it in GitHub Desktop.
jQuery resizestart and resizeend events
var resizeTimer = false;
$(window).on('resize', function(e) {
if( !resizeTimer ) {
$(window).trigger('resizestart');
}
clearTimeout(resizeTimer);
resizeTimer = setTimeout(function() {
resizeTimer = false;
$(window).trigger('resizeend');
}, 250);
}).on('resizestart', function(){
console.log('Started resizing the window');
}).on('resizeend', function(){
console.log('Done resizing the window');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment