Skip to content

Instantly share code, notes, and snippets.

@jordanneenan
Last active August 29, 2015 14:25
Show Gist options
  • Select an option

  • Save jordanneenan/c1f273079e3ea99b3562 to your computer and use it in GitHub Desktop.

Select an option

Save jordanneenan/c1f273079e3ea99b3562 to your computer and use it in GitHub Desktop.
Call function after timeout on page resize
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;
alert('Done resizing');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment