Created
February 18, 2014 18:35
-
-
Save JuggoPop/9076929 to your computer and use it in GitHub Desktop.
Responsive JS --Run other JS on page load and on resize
This file contains 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 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