Skip to content

Instantly share code, notes, and snippets.

@mikedugan
Created November 7, 2013 14:39
Show Gist options
  • Select an option

  • Save mikedugan/7355631 to your computer and use it in GitHub Desktop.

Select an option

Save mikedugan/7355631 to your computer and use it in GitHub Desktop.
detects and executes function on window resize with 1 second delay
var id;
$(window).resize(function() {
clearTimeout(id);
id = setTimeout(function() {
if($(window).innerHeight() < 700 || $(window).innerWidth < 900) {
//do this if it's being resized down && params met
}
else {
//do this if it's being resized up
}
}, 1000);
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment