Skip to content

Instantly share code, notes, and snippets.

@normansolutions
Created January 7, 2014 14:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save normansolutions/8300020 to your computer and use it in GitHub Desktop.
Save normansolutions/8300020 to your computer and use it in GitHub Desktop.
//cdn fallback for Bootstrap css
<div id="bootstrapCssTest" class="hide"></div> // (HTML in _Layout.cshtml)
if ($('#bootstrapCssTest').is(':visible') === true) {
$('<link href="\css/bootstrap.min.css" rel="stylesheet" type="text/css" />').appendTo('head');
}
//cdn fallback for Bootstrap js
if (typeof ($.fn.modal) === 'undefined') {
$('<script src="\scripts/bootstrap.min.js">\x3C/script>').appendTo('head');
}
//cdn fallback for jQuery
<script>window.jQuery || document.write('<script src="\scripts/jQuery.min.js">\x3C/script>')</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment