Skip to content

Commit 3610382

Browse files
committed
Merge branch 'jquerify-noconflict' of https://github.com/jasonkarns/devtools-snippets
2 parents 10bacbb + c435308 commit 3610382

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

snippets/jquerify/jquerify.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,19 @@
55
(function () {
66

77
if ( !window.jQuery ) {
8+
var dollarInUse = !!window.$;
89
var s = document.createElement('script');
910
s.setAttribute('src', '//ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js');
11+
s.addEventListener('load', function(){
12+
console.log('jquery loaded!');
13+
14+
if(dollarInUse) {
15+
jQuery.noConflict();
16+
console.log('`$` already in use; use `jQuery`');
17+
}
18+
});
19+
1020
document.body.appendChild(s);
11-
console.log('jquery loaded!');
1221
}
1322

1423
})();

0 commit comments

Comments
 (0)