Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/nwinch/jquery-slacker

jQuery plugin for lazy loading images
https://github.com/nwinch/jquery-slacker

Last synced: 18 days ago
JSON representation

jQuery plugin for lazy loading images

Awesome Lists containing this project

README

        

Slacker
=============

jQuery plugin for lazy loading images.

Why?
----
There are many great lazy load plugins out there, but none seemed to capture everything that I wanted to achieve for a project at the time. So I
created my own - with the specific aim that it would load different size/quality images on the fly and only when required.

HTML
----
### Basic

`

`
``

### Multiple resolutions

`

`

### High quality images
You can split any resolution check into high and low quality image options. Slacker will detect if you are using a high pixel density
ratio (current check is for > 1).
`

`

JavaScript
----------

### Basic

`$('.slacker').slacker();`

### Multiple resolutions

`$('.slacker').slacker({
sizes : [640]
});`

### Resize functionality

This will allow multiple resolutions to be switched on the fly when resizing the browser.

@resize - true|false; default=true; Enable/disable resize functionality.

@resizeThrottle - (millisecond); default=100; Throttle functionality will control how frequently the window resize event is fired. Higher number is less frequent.

`$('.slacker').slacker({
resize : true
, resizeThrottle : 100
});`

### Animation

There are two handlers - 'beforeLoad' and 'onLoad'.
`$('.slacker').slacker({
animate : {
beforeLoad : function(el) {
el.css({ opacity:0 });
}
, onLoad : function(el) {
el.animate({ opacity:1 }, 1000);
}
}
});`