the compact javascript framework
in partnership with mediatemple
provides dynamic loading for images, css and javascript files.
MIT-style license.
Assets.js | provides dynamic loading for images, css and javascript files. |
Properties | |
javascript | Injects a javascript file in the page. |
css | Injects a css file in the page. |
image | Preloads an image and returns the img element. |
images | Preloads an array of images (as strings) and returns an array of img elements. |
Injects a javascript file in the page.
source | the path of the javascript file |
properties | some additional attributes you might want to add to the script element |
new Asset.javascript('/scripts/myScript.js', {id: 'myScript'});
Injects a css file in the page.
source | the path of the css file |
properties | some additional attributes you might want to add to the link element |
new Asset.css('/css/myStyle.css', {id: 'myStyle', title: 'myStyle'});
Preloads an image and returns the img element. does not inject it to the page.
source | the path of the image file |
properties | some additional attributes you might want to add to the img element |
new Asset.image('/images/myImage.png', {id: 'myImage', title: 'myImage', onload: myFunction});
the img element. you can inject it anywhere you want with Element.injectInside/Element.injectAfter/Element.injectBefore
Preloads an array of images (as strings) and returns an array of img elements. does not inject them to the page.
sources | array, the paths of the image files |
options | object, see below |
onComplete | a function to execute when all image files are loaded in the browser’s cache |
onProgress | a function to execute when one image file is loaded in the browser’s cache |
new Asset.images(['/images/myImage.png', '/images/myImage2.gif'], { onComplete: function(){ alert('all images loaded!'); } });
the img elements as $$. you can inject them anywhere you want with Element.injectInside/Element.injectAfter/Element.injectBefore
Documentation by Aaron Newton & Mootools Developers, generated by NaturalDocs and GeSHi