mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 18:55:26 +00:00
| .. | ||
| .bower.json | ||
| .gitignore | ||
| bower.json | ||
| ChangeLog | ||
| LICENSE | ||
| load.js | ||
| load.min.js | ||
| README.md | ||
Load.js
Dynamically loading external JavaScript and CSS files
Install
bower install load
How use?
Create html page with js connected.
<script src="load.min.js"></script>
Than try one of this:
load.js('jquery.js', function(error) {
/* you could use jquery functions here */
});
load.css('menu.css', function(error) {
/* load menu css and then do some magic */
});
/* recognition file type by extension */
load('css-or-.js', function(error, event) {
console.log(error || event);
});
load('template/footer.html', function(error, footer) {
console.log(error || footer);
});
load.json('config.json', function(error, config) {
console.log(error || config);
});
load.ajax('template/header.html', function(error, header) {
console.log(error || header);
});
/* load one-by-one */
load.series([
'jquery.js',
'jq-console.js',
], function() {
});
/* load all together and call callback */
load.parallel([
'menu.css',
'menu.js',
], function() {
});
License
MIT