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

studiometa/js-lazyload

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Utilisation

<img class="js-lazy"
	src="blank.gif"
	data-src-large="image@large.jpg"
	data-src-medium="image@medium.jpg"
	data-src-small="image@small.jpg"
	data-src="image.jpg">

<div class="js-lazy"
	data-src-large="image@large.jpg"
	data-src-medium="image@medium.jpg"
	data-src-small="image@small.jpg"
	data-src="image.jpg">
</div>
var lazy = new Lazy({
	src: 'data-src',
	selector: '.js-lazy',
	separator: ' | ',
	breakpoints: [
		{
			width : 1300,
			src   : 'data-src-large'
		},
		{
			width : 1000,
			src   : 'data-src-medium'
		},
		{
			width : 600,
			src   : 'data-src-small'
		}
	],
	offset: window.innerHeight/2,
	onError: function() {},
	errorClass: 'has-error',
	onSuccess: function() {},
	successClass: 'is-loaded'
});

window.addEventListener('load', function() {
	lazy.init();
});

About

Lazyload images, with breakpoints and retina options.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published