I am lazy loading images on the page, using the lazysizes library I call the script at the beginning of the page
<script> (function(){ window.lazySizesConfig = { lazyClass: 'lazy', loadMode: 2, hFac: 10, }; }); </script>
But the question arose, how to make it so that after loading the page, after a couple of seconds, all the pictures on lazy loaded without waiting for the page to scroll?
I couldn’t find a suitable parameter in the documentation, or I don’t understand something
>Solution :
You can manually run through all your elements and load them using unveil method
setTimeout(
function () {
$('.lazy').each(function () {
lazySizes.loader.unveil($(this)[0])
});
},
2000
);