Last active
June 11, 2022 16:04
-
-
Save thomasmb/92abf82e1ea1a251c93f57a6034f00d6 to your computer and use it in GitHub Desktop.
jQuery resizestart and resizeend events
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
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