Skip to content

Instantly share code, notes, and snippets.

@shalecraig
Forked from arigesher/inline-jquery-delay
Created February 18, 2014 00:45
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 shalecraig/9062317 to your computer and use it in GitHub Desktop.
Save shalecraig/9062317 to your computer and use it in GitHub Desktop.
var waitForJquery = function(jqueryCallback, interval) {
if(typeof $ === 'function') {
jqueryCallback();
} else {
setTimeout(function() {
if(typeof $ === 'function'){
jqueryCallback();
} else {
waitForJquery(jqueryCallback, interval);
}
}, interval);
}
}
waitForJquery(function() {
$('#dostuff');
}, 50); // poll for jquery every 50ms
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment