Home > Article > Web Front-end > jquery.lazyload implements lazy loading of images jquery plug-in_jquery
What is ImageLazyLoad technology
When there are many images on the page, opening a page will inevitably cause a large amount of data interaction with the server. Especially for high-definition pictures, they take up several M of space. ImageLazyLoad technology is that the pictures on the currently visible interface are loaded, but the pictures on the invisible page (visible by pulling down the scroll bar) are not loaded, which will inevitably lead to a qualitative improvement in speed.
How to implement ImageLazyLoad
1. Use JQuery plug-in, plug-in name: jquery.lazyload (7kb size), compressed (3kb size)
Online compressed js http://closure-compiler.appspot.com/home
Although it is a very awesome special effect, using the JQuery plug-in only requires a few lines of code. The usage process is as follows:
1. Import JS plug-in
2. Add the following javascript to your page:
$("img").lazyload();
This will cause all images to be loaded lazily.
Of course the plug-in also has several configuration items to set.
1. Change threshold
$(“img”).lazyload({ threshold : 200 });
Set the threshold to 200, which means that when the picture is not viewed First load 200 pixels before reaching.
2. Of course, you can also trigger the loading image event by setting placeholder images and custom events
If you are a fan of JS frameworks such as Jquery, Prototype, etc., they all provide customized LazyLoad Plugin;
Can be viewed
http://www.appelsiini.net/projects/lazyload
LazyLoad (lazy loading) technology is not only used to delay loading of images in web pages, but also for data. Google Reader and Bing image search make full use ofLazyLoad technology;