Prevent images and videos to load before the page is fully loaded even if they are on screen
Author: devweebdevCreated Mar 25, 2023Updated Mar 26, 2023
LabelsTYPE: Question
Hi guys,
I'm pretty new using vanilla-lazyload and this is awesome ! However, I have a small problem, when I use Google PageSpeedInsights, I can clearly see that my video and images that are visible on the screen on page load are being loaded by the lazyload even though the page is not done loading.
Here is my code which is located in a js script file with defer attribute :
document.addEventListener('DOMContentLoaded', () => { var lazyLoadInstance = new LazyLoad(); });
I do not understand why it does not wait for the page is fully loaded. Can someone help me please?
Source: verlok/vanilla-lazyload