Sha256: 7e886ac614a96b8428c4058fe1949adcc90a592a725a5bd6d7bef76ec6490f21
Contents?: true
Size: 472 Bytes
Versions: 10
Compression:
Stored size: 472 Bytes
Contents
// Lazy load images // ex. <img src="/path/to/small-placeholder_image.png" data-src="/path/to/actual_image.jpg" alt="You better not leave it blank"> const imageList = document.querySelectorAll('img[data-src]'); // Our lazyloading images use a data-src to hold the actual image source. function lazyLoad() { for (const img of imageList) { img.src = img.getAttribute('data-src'); img.onload = () => img.removeAttribute('data-src'); } } export default lazyLoad;
Version data entries
10 entries across 10 versions & 1 rubygems