Skip to content

Instantly share code, notes, and snippets.

@JuggoPop
Created February 18, 2014 18:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JuggoPop/9076929 to your computer and use it in GitHub Desktop.
Save JuggoPop/9076929 to your computer and use it in GitHub Desktop.
Responsive JS --Run other JS on page load and on resize
function resizeStuff() {
// stuff you want to run on page load and resizes goes here
}
// Runs above function once on page load
// and again after window resize.
var TO = false;
$(window).resize(function () {
if (TO !== false) {
clearTimeout(TO);
}
TO = setTimeout(resizeStuff, 200);
}).resize();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment