Skip to content

Instantly share code, notes, and snippets.

@teodragovic
Forked from getify/gist:670840
Last active December 31, 2015 06:09
Show Gist options
  • Save teodragovic/7945309 to your computer and use it in GitHub Desktop.
Save teodragovic/7945309 to your computer and use it in GitHub Desktop.
some modifications to original script...
// JQuery /w fallback + main.js
function loadJquery(scripts,idx) {
function fallback() {
clearTimeout(timeout);
if (typeof jQuery === 'undefined') {
if (idx < scripts.length-1) loadJquery(scripts,idx+1);
} else {
//load scripts that depend on jquery or just return
$LAB.script("javascripts/main.js");
}
}
if (idx == null) idx = 0;
$LAB.script(scripts[idx].src).wait(fallback);
var timeout = setTimeout(fallback,500);
}
loadJquery([
{src:"//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"},
{src:"/javascripts/libs/jquery.min.js"}
]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment