Skip to content
This repository has been archived by the owner on Mar 28, 2019. It is now read-only.

Latest commit

 

History

History
29 lines (24 loc) · 705 Bytes

readme.md

File metadata and controls

29 lines (24 loc) · 705 Bytes

Loader

js-loader is a script that simulates a loader by loading one image after another. It allows you to run a callback after each image loaded and when all images are loaded.

Used for the loader on Signes du quotidien.

Use

var images = [
	'<img data-src="image.jpg">',
	'<img data-src="image.jpg">',
	'<img data-src="image.jpg">',
	'<img data-src="image.jpg">',
	'<img data-src="image.jpg">',
	'<img data-src="image.jpg">',
	'<img data-src="image.jpg">'
];

var loader = new Loader(images, {
	attr: 'data-src',
	onImageLoad: function(percentage) {
		console.log(percentage);
	},
	onComplete: function() {
		console.log('Chargement terminé !');
	}
});