irigsoft Posted March 28, 2025 Posted March 28, 2025 Hi, I want to use lazysizes.min.js script from https://github.com/aFarkas/lazysizes?ref=hackernoon.com so I add it into my custom files, but there second step, how to set this Add the class "lazyload" to your images/iframes on my components? How to 1. Download the lazysizes.min.js script and include lazysizes in your webpage. 2. lazysizes does not need any JS configuration: Add the class "lazyload" to your images/iframes in conjunction with a data-src and/or data-srcset attribute. Optionally you can also add a src attribute with a low quality image: <!-- non-responsive: --> <img data-src="image.jpg" class="lazyload" /> <!-- responsive example with automatic sizes calculation: --> <img data-sizes="auto" data-src="image2.jpg" data-srcset="image1.jpg 300w, image2.jpg 600w, image3.jpg 900w" class="lazyload" /> <!-- iframe example --> <iframe frameborder="0" class="lazyload" allowfullscreen="" data-src="//www.youtube.com/embed/ZfV-aYdU4uE"> </iframe> Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.