Skip to content

Instantly share code, notes, and snippets.

@Strongground
Last active August 12, 2020 08:12
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 Strongground/d74b43bb5eb219e7876d723124132da9 to your computer and use it in GitHub Desktop.
Save Strongground/d74b43bb5eb219e7876d723124132da9 to your computer and use it in GitHub Desktop.
Defer method to deferred loading of any method requiring jQuery on root level of webpages
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