This article mainly introduces how to implement delayed loading of webpage images in js to speed up webpage opening. Interested friends can refer to many methods to speed up webpage loading, using jquery. lazyload. js achieves asynchronous and delayed loading of images. For websites with a large number of images on the page, it is a good way to increase the speed of webpage opening. On the left side of the bar page of the Code official website, you can see an article thumbnail display module during PC preview, which will prolong the webpage loading time to a certain extent. This article uses asynchronous and delayed loading of images to speed up page loading on this site.
Asynchronous image loading means that you do not need to load and display all the images on the page at a time. Only when you slide the scroll bar to a certain position will the image at the corresponding position be loaded, this improves the webpage loading speed and user experience.
There are a lot of technical articles with a lot of images. If you need to load all the images at a time when you open the web page, the user's waiting time must be very long. This will make the user experience very bad, and there is no need to load all the images on the page at a time. Asynchronous and delayed loading of images is the most reasonable and appropriate method in web design.
We use jquery. lazyload. js to Implement Asynchronous and delayed image loading. Remember to load jQuery first.
1. Import JS plug-ins: