日本語→README.ja.md
Run callback when each/all specified images are loaded.
See sample JS. -> sample/sample.js
Paste content of preload-image.min.js and:
preloadImages([
'path/to/image1',
'path/to/image2',
'path/to/image3'
])
.onprogress(function(data) {
var loaded = data.loadeds.length;
var all = data.files.length;
var progress = parseInt(100 * loaded / all, 10);
console.log(
data.path, 'is loades.',
'Status:', loaded + '/' + all, '(' + progress + '%)'
);
// show image on browser
document.body.appendChild(data.image);
})
.onload(function(data) {
console.log('Done.');
})
.onerror(function(data) {
console.error('ERROR!', data.event);
});
- TAKANASHI Ginpei
- ginpei/preload-image.js
- MIT License: http://opensource.org/licenses/MIT
- 2014-11-08
- First release.