Sha256: 76ed5361a5aec739b4927347fbd427783f7eb000d17d32cbe5513ac1bede3ae7
Contents?: true
Size: 739 Bytes
Versions: 78
Compression:
Stored size: 739 Bytes
Contents
document.addEventListener("DOMContentLoaded", function() { var lazyImages = [].slice.call(document.querySelectorAll("img.lazy-loading")); if ("IntersectionObserver" in window) { let lazyImageObserver = new IntersectionObserver(function(entries, observer) { entries.forEach(function(entry) { if (entry.isIntersecting) { let lazyImage = entry.target; lazyImage.src = lazyImage.dataset.src; lazyImage.classList.remove("lazy-loading"); lazyImageObserver.unobserve(lazyImage); } }); }); lazyImages.forEach(function(lazyImage) { lazyImageObserver.observe(lazyImage); }); } else { // Possibly fall back to a more compatible method here } });
Version data entries
78 entries across 78 versions & 2 rubygems