-
-
Save redpop/40d9a5feb511c2bd5301 to your computer and use it in GitHub Desktop.
JavaScript window resize event with a 100ms delay #resize #event #window
This file contains hidden or 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() { | |
| let resizeEnd; | |
| $(window).on('resize', function() { | |
| clearTimeout(resizeEnd); | |
| resizeEnd = setTimeout(function() { | |
| $(window).trigger('resize-end'); | |
| }, 100); | |
| }); | |
| // Example | |
| $(window).on('resize-end', function() { | |
| console.log('window resized!'); | |
| }); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment