jQuery Lazy Load Image Plugin Lazy Load XT
Add-ons

Plugin description: jQuery lazy-loading image plugin that also supports lazy loading for videos and other media.
jQuery lazy-loading image plugin that also supports lazy loading for videos and other media.
A mobile-friendly, fast, and extensible jQuery plugin for lazy loading images and videos, with built-in support for the jQueryMobile framework.
Usage
Add jquery.lazyloadxt.min.js:
1 | <script src="jquery.lazyloadxt.min.js"></script> |
When replacing the src attribute with the data-src attribute, choose to add a placeholder src and a fallback image:
1 2 | <img class="lazy" data-src="lazy.jpg" width="100" height="100"><noscript><img src="lazy.jpg" width="100" height="100"></noscript> |
It is recommended to keep the attribute order consistent in these two tags so that the code can be compressed efficiently with gzip.
If you use a fallback image, hide the first image using CSS (otherwise, browsers with broken JavaScript support will display both images):
1 2 3 | img.lazy { display: none;} |
The Lazy Load XT plugin removes this class during image initialization (classNojs option).
评论