Snorlax
§ Version: 1.0.0
§ Author: Walla!Code
§ Repo: https://github.com/wallacode/snorlax
This plugin doesn't need jQuery and is totaly standalone, the minified size is 1.86Kb !!!
Demo Page
Use
HTML
Javascript
regular:
var lazy = ;
Horizontal Lazy Load
HTML
Javascript
var lazy = horizontal: true wrap: 'demo';
Callbacks
If you want you can create youre own loading function, this function will run when its the items time to be loaded
{ ;}
Options
var lazy = threshold: 100 attrPrefix: 'data-snorlax' cssClassPrefix: 'snorlax' scrollDelta: 0 event: 'scroll' horizontal: true wrap: 'demo';
Name | Default | Description |
---|---|---|
threshold | 400 | number of pixels to load the image |
attrPrefix | 'data-snorlax' | prefix for the attrs on the html |
cssClassPrefix | 'snorlax' | prefix for the css classes |
scrollDelta | 100 | (px) the interval for the scroll event, 0 for every scroll event |
event | 'scroll' | which event will trigger the loading |
horizontal | false | will set the lazy loader to work horizontaly |
wrap | '' | ID of the wrapper of the horizontal scroll, in the most of the times it will be a UL ID |
Methods
loadAll() will load all the objects.
var lazy = ;...lazy;
refreshConfig(config) change the config of Snorlax.
var lazy = ;...lazy;
stop() stop Snorlax
var lazy = ;...lazy;
start() start Snorlax
var lazy = ;...lazystart;