Created
June 22, 2017 11:09
-
-
Save sy/39cd4dfde741127e19202d5f56386f53 to your computer and use it in GitHub Desktop.
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
var rtime; | |
var timeout = false; | |
var delta = 200; | |
$(window).resize(function() { | |
rtime = new Date(); | |
if (timeout === false) { | |
timeout = true; | |
setTimeout(resizeend, delta); | |
} | |
}); | |
function resizeend() { | |
if (new Date() - rtime < delta) { | |
setTimeout(resizeend, delta); | |
} else { | |
timeout = false; | |
console.log('Done resizing'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment