Created
April 13, 2011 11:28
-
-
Save slikts/917379 to your computer and use it in GitHub Desktop.
Load jQuery from Google CDN
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
/* | |
* @param object callback | |
* @param object document context | |
* / | |
function load_jq(callback, document) | |
{ | |
if (window.jQuery) { | |
if (callback) { | |
callback(jQuery); | |
} | |
return; | |
} | |
var d = document || window.document; | |
var s = d.createElement('script'); | |
s.onload = function() | |
{ | |
jQuery.noConflict(); | |
if (callback) { | |
callback(jQuery); | |
} | |
} | |
s.setAttribute('src', location.protocol + '//ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js'); | |
d.getElementsByTagName('head')[0].appendChild(s); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment