JavaScript image loading library Echo. js, javascriptecho. js
Echo is an independent JavaScript tool for loading images lazily. It is fast, small (less than 1 k), and uses HTML5 data-attributes. Echo supports IE8 +.
Plug-in description: like Lazy Load, Echo. js is also used for image delayed loading of JavaScript. The difference is that Lazy Load is a jQuery-based plug-in, while Echo. js is independent of jQuery or other JavaScript libraries and can be used independently. In addition, Echo. js is very small and less than 1 kb after compression.
Compatibility
Echo. js uses the date attribute of HTML5 and needs to obtain the value of this attribute. Therefore, it is not compatible with IE6 and IE7. Although Lazy Load also uses the date attribute of HTML5, the methods for obtaining values are different.
Usage
1. Import files
Copy codeThe Code is as follows:
<Script src = "js/echo. min. js"> </script>
2. HTML
Copy codeThe Code is as follows:
Blank.gif is a 1x1 image. It is used as the default image. The attribute value of data-echo is the real address of the image. Similarly, it is best to set the width and height for the image, or set it in CSS. Otherwise, it seems that the image at the very bottom will be delayed.
3. JavaScript
Echo.init({offset: 0,throttle: 0});
Parameters
Parameters |
Description |
Offset |
How many pixels can an image be loaded from the visible area? |
Throttle |
How many milliseconds of image loading latency |
The above content is for the JavaScript image delay loading library Echo. js, I hope to help you!
Articles you may be interested in:
- Loading Baidu sharing code with JS latency to improve webpage speed
- Implementation methods and ideas of js image delayed Loading
- Move the mouse over js Code to implement delayed loading and hide Layers
- Several Methods for loading JavaScript code with delay accelerate webpage access
- How to Use the jquery plug-in lazyload. js to delay image loading
- How to Use the Jquery. lazyload. js extension for jquery image delayed Loading
- Analysis on js pre-loading/delayed Loading