Skip to content

Instantly share code, notes, and snippets.

@olimortimer
Created March 12, 2012 14:56
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save olimortimer/2022468 to your computer and use it in GitHub Desktop.
Save olimortimer/2022468 to your computer and use it in GitHub Desktop.
CDN Fallbacks
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="js/jquery-1.7.2.min.js"><\/script>')</script>
<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.8.21/jquery-ui.min.js"></script>
<script>window.jQuery.ui || document.write('<script src="js/jquery-ui-1.8.21.min.js"><\/script>')</script>
<script src="//ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js"></script>
<script>window.swfobject || document.write('<script src="js/swfobject-2.2"><\/script>')</script>
<link rel="stylesheet" href="//ajax.googleapis.com/ajax/libs/jqueryui/1.8.21/themes/base/jquery-ui.css" />
<div class="ui-helper-hidden"></div>
<script>
$(document).ready(function() {
// Checks if the above is hidden (by jQuery UI) and if not, use the local UI CSS file
if ($('.ui-helper-hidden:first').is(':visible') === true) {
$('<link rel="stylesheet" href="css/jquery-ui-1.8.21.css" />').appendTo('head');
}
});​
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment