Skip to content

Instantly share code, notes, and snippets.

@kopiro
Created February 2, 2012 20:58
Show Gist options
  • Save kopiro/1725714 to your computer and use it in GitHub Desktop.
Save kopiro/1725714 to your computer and use it in GitHub Desktop.
Incapsulate jQuery
jQueryOnLoad = function(callback){
var jQs = document.createElement('script');
jQs.setAttribute("src", "//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js");
document.body.appendChild(jQs);
var jQi = setInterval(function()
{
if (!window['jQuery']) return;
clearInterval(jQi);
jQuery.noConflict();
callback.apply();
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment