Home  >  Article  >  Web Front-end  >  How to use Jquery image lazy loading plug-in jquery.lazyload.js_jquery

How to use Jquery image lazy loading plug-in jquery.lazyload.js_jquery

WBOY
WBOYOriginal
2016-05-16 16:47:301084browse

The latest version of jquery.lazyload.js is no longer pseudo lazy loading

1. Please follow the basic usage instructions to set up

Copy code The code is as follows:

//Load JavaScript file


Copy the code The code is as follows:

//None of the 4 attributes of the img tag can be missing , otherwise the delayed loading effect cannot be achieved, as follows:

Copy code The code is as follows:

//Use
$(function() {
$("img.lazy").lazyload();
});

2. Description of common attributes

Copy code The code is as follows:

threshold: 200 //Set the sensitivity, indicating entering the display area Start loading when there are still 200 pixels left
effect: "fadeIn" //Use fade-in effect
failure_limit: 10 //Tolerance range, be sure to set this value, please refer to the original document for the reason

container: $("#container") //Use the parent container. The CSS style of the parent container should contain at least two attributes "height: 600px;overflow: scroll;"

event: "click" //Modify the trigger event to click

3. Reference

English reference: http://www.appelsiini.net/projects/lazyload

Chinese reference: http://code.ciaoca.com/jquery/lazyload/

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn