Skip to content

Instantly share code, notes, and snippets.

@timwburch
Created July 25, 2016 00:48
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 timwburch/93c8bb55f55a752fc1b6115238755bdd to your computer and use it in GitHub Desktop.
Save timwburch/93c8bb55f55a752fc1b6115238755bdd to your computer and use it in GitHub Desktop.
// Check that jQuery is
// loaded with an upper limit
// for the number of calls.
function checkjQuery(upper) {
if (typeof jQuery != 'undefined') {
jQuery(document).ready(function () {
// jQuery dependant function
});
} else {
if (upper <= 100) {
var checkjQueryTimeout = setTimeout(checkjQuery(upper + 1), 200);
}
}
}
setTimeout(function() { checkjQuery(1) }, 100);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment