Last active
August 29, 2015 14:01
-
-
Save dustintheweb/62f1cc36ef75cb42ac7d to your computer and use it in GitHub Desktop.
Modernizr load CDN script with local fallback
This file contains hidden or 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
Modernizr.load([{ | |
load: [ | |
'//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js' | |
], | |
complete: function() { | |
if (!window.jQuery) { | |
console.log('## CDN Failed - Loading local version of jQuery.'); | |
Modernizr.load('/js/jquery.min.js'); | |
}; | |
} | |
}]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Example
if (typeof($.fn.owlCarousel) === 'undefined')
This checks to see if it created its global function.