Echo.js Pure JavaScript Lightweight deferred loading instance code
Demonstrate
Application
1. Introduce JS, and initialize
<script src= "{sh::P ub}js/echo.min.js" ></script>
<script>
echo.init ({
offset:0,
throttle:0
});
</script>
2. Attach attributes to pictures
3. Set the default background for the picture that is not loaded, animated GIF
. Lazy{width:100%;height:100%;background:url ({sh::P ub}img/common/loading.gif) 50% no-repeat;}
Very convenient, very practical.
To further improve the speed of Web page opening, you can optimize the upload of the picture.
Web slow, nothing more, a query slow, two pictures loaded slowly, three did not use delayed loading, four picture data too large.
According to these reasons, gradually resolved.
Enhance the user experience.
The above echo.js pure JavaScript lightweight Delay loading example code is small series to share all the content, hope to give you a reference, but also hope that we support cloud habitat community.