Socket
Socket
Sign inDemoInstall

jquery-zload

Package Overview
Dependencies
0
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    jquery-zload

Blazing fast jQuery plugin for lazy loading background images.


Version published
Maintainers
1
Install size
5.54 kB
Created

Readme

Source

jquery-zload

Blazing fast jQuery plugin for lazy loading background images.

Note: This plugin is designed for performance over features. It only handles the background-image css property and it will wait for scrolling to stop before doing any work. For a full featured solution that also handles horizontal scrolling and img tags, check out Mika Tuupola's LazyLoad: http://www.appelsiini.net/projects/lazyload.

Use

$('.image-container').zload()

At its simplest this is all you need. Zload will detect when the user has stopped scrolling and then set the background-image property on any elements that are within the viewport bounds. See defaults below.

Configuration

The .zload() function takes an options object as its only argument. Calling it without arguments is the same as passing these defaults:

$('.image-container').zload({
	attribute : 'original',
	unload    : false,
	fallback  : 'none',
	delay     : 30
});

###attribute### The name of the data attribute attached to lazy loading elements. I.e. the default, original will expect the presence of an attribute named data-original

###unload### Setting unload : true will make background images disappear whenever an element scrolls out of the viewport again (and re-appear when the element scrolls back in). Great for minimizing memory footprint. Defaults to false. ###fallback### If you'd like some other default background image to show when the element is scrolled out of the viewport you can set it here, i.e. 'images/notloaded.png'. Defaults to 'none'. ###delay### Lets you customize how long the pause in scrolling has to be for Zload to kick in and start applying background images. Defaults to 30 milliseconds.

##Contact##

Keywords

FAQs

Last updated on 27 Jun 2016

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc