Created
November 28, 2014 10:57
-
-
Save Fridus/52bfe0a919e553a97411 to your computer and use it in GitHub Desktop.
jQuery getScript multiple
This file contains 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
jQuery.getScripts = function(scripts, callback) { | |
var progress = 0; | |
var _getScript = function() { | |
if (progress == scripts.length) { return callback(); } | |
$.getScript(scripts[progress], function() { | |
progress++; | |
_getScript(); | |
}); | |
}; | |
_getScript(); | |
}; | |
/* | |
$.getScripts(['script1','script2','script3', function(){ | |
Code... | |
}); | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment