Lazy comes with a bunch of easy to use configuration options by default, to control nearly every behavior as you like. The following parameters are available on every instance:

Name Type Default Description
name string lazy Internal name, used for namespaces and bindings.
chainable true By default Lazy is chainable and will return all elements. If set to false Lazy will return the created plugin instance itself for further use.
autoDestroy true Will automatically destroy the instance when no further elements are available to handle.
bind string load If set to load Lazy starts working directly after page load. If you want to use Lazy on own events set it to event.
threshold integer 500 Amount of pixels below the viewport, in which all images gets loaded before the user sees them.
visibleOnly false Determine if only visible elements should be load.
appendScroll object window An element to listen on for scroll events, useful when images are stored in a container.
scrollDirection string both Determines the handles scroll direction. Possible values are both, vertical and horizontal.
imageBase string null If defined this will be used as base path for all images loaded by this instance.
defaultImage string blank image Base64 image string, set as default image source for every image without a predefined source attribute.
placeholder string null Base64 image string, set a background on every element as loading placeholder.
delay integer -1 If you want to load all elements at once after page load, then you can specify a delay time in milliseconds.
combined false With this parameter, Lazy will combine the event driven and delayed element loading.
Name Type Default Description
attribute string data-src Name of the image tag src attribute, where the image path is stored.
srcsetAttribute string data-srcset Name of the image tag srcset attribute, where the source set is stored.
sizesAttribute string data-sizes Name of the image tag sizes attribute, where the size definition for source set is stored.
retinaAttribute string data-retina Name of the image tag attribute, where the path for optional retina image is stored.
loaderAttribute string data-loader Name or the element attribute, where the identifier of the plugin or customer loader is sored.
imageBaseAttribute string data-imagebase Name ot the image tag element, where the specific image base is stored. This will overwrite the global imageBase config.
removeAttribute true Determine if the attribute should be removed from the element after loading.
handledName string handled Name of the element tag data attribute, to determine if element is already handled.
loadedName string loaded Name of the element tag data attribute, to determine if element is already loaded.
Name Type Default Description
effect string show Function name of the effect you want to use to show the loaded images, like show or fadein.
effectTime integer 0 Time in milliseconds the effect should use to view the image.
Name Type Default Description
enableThrottle true Throttle down the loading calls on scrolling event.
throttle integer 250 Time in milliseconds the throttle will use to limit the loading calls.
Name Type Default Description
beforeLoad function undefined Callback function, which will be called before the element gets loaded. Has current element and response function as parameters. this is the current Lazy instance.
afterLoad function undefined Callback function, which will be called after the element was loaded. Has current element and response function as parameters. this is the current Lazy instance.
onLoad function undefined Callback function, which will be called if the element could not be loaded. Has current element and response function as parameters. this is the current Lazy instance.
onFinishedAll function undefined Callback function, which will be called after all elements was loaded or returned an error. This callback has no parameters. this is the current Lazy instance.

Configure your Lazy instances with an initial configuration object:

$('.lazy').Lazy({ // your configuration goes here scrollDirection: 'vertical', effect: 'fadeIn', visibleOnly: true, onError: function(element) { console.log('error loading ' + element.data('src')); } });

 

Or read and change the configuration live at runtime with the public config function. Please note the chainable parameter!

var lazy = $('.lazy').Lazy({ chainable: false }); var attributeName = lazy.config('attribute'); // get lazy.config('effect', 'show'); // set


Related news

Catholiques traditionalistes m6 direct
Boku wa tomodachi live action sub indo fantastic 4
Mangawhero road matamata accommodation
Ouvir arrochar e quebrar anginas
Survey questionnaire for food safety
Ac pg accomodation in perungudi chennai
Stoke mandeville hospital doctors accommodation definition
Piscinas pequenas com churrasqueira