Made by @raphamorim
Status:
Loading...
Total of Images Loaded:
0
Total of Images Failed:
0
$ bower install imgStatus
$ npm install imgstatus
imgStatus.watch('.image', function(imgs){
console.log(imgs.loaded); // Number of Images Loaded (Type: integer)
console.log(imgs.failed); // Number of Images Failed (Type: integer)
console.log(imgs.isDone()); // If already load OR fail every image (Type: boolean)
});
var imagesLoaded = document.querySelector('.images-loaded'),
imagesFailed = document.querySelector('.images-failed'),
imagesStatus = document.querySelector('.images-status');
imgStatus.watch('.image', function(imgs) {
imagesLoaded.innerHTML = imgs.loaded;
imagesFailed.innerHTML = imgs.failed;
if (imgs.isDone())
imagesStatus.innerHTML = 'Completed!';
});