Created
December 2, 2016 14:28
-
-
Save madeindjs/7ea13d03d6699f5f84761a12bff86ff5 to your computer and use it in GitHub Desktop.
make script execution wait until jquery is loaded
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 defer(method) { | |
if (window.jQuery) | |
method(); | |
else | |
setTimeout(function() { defer(method) }, 50); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment