1(function (app) { 2 ("use strict"); 3 4 var LazyLoad = function () { }; 5 6 LazyLoad.prototype.init = function () { 7 LazyLoad.prototype.images(); 8 }; 9 10 LazyLoad.prototype.images = function () { 11 const lazyImages = gsap.utils.toArray("img[loading='lazy']"); 12 if (!lazyImages.length) return; 13 14 const config = { 15 lazy: true, 16 timeout: 1, 17 } 18 19 const timeout = gsap.delayedCall(config.timeout || 1, ScrollTrigger.refresh).pause(); 20 const lazyMode = config.lazy !== false; 21 const imgLoaded = lazyImages.length; 22 23 onImgLoad = () => lazyMode ? timeout.restart(true) : --imgLoaded || ScrollTrigger.refresh(); 24 25 lazyImages.forEach((img, i) => { 26 lazyMode || (img.loading = "eager"); 27 img.naturalWidth ? onImgLoad() : img.addEventListener("load", onImgLoad); 28 }); 29 30 }; 31 32 LazyLoad.prototype.iframes = function () { 33 const lazyIframes = $("iframe[lazy-iframe]"); 34 if (!lazyIframes.length) return; 35 36 lazyIframes.each(function (index) { 37 const self = $(this); 38 const dataSrc = self.data("src"); 39 40 if (dataSrc) { 41 self.attr("src", dataSrc); 42 self.removeAttr("data-src"); 43 } 44 45 if (index + 1 === lazyIframes.length) { 46 app.Global.prototype.refreshScrollTriggers(); 47 } 48 }); 49 }; 50 51 app.LazyLoad = LazyLoad; 52 53 app.ready(function () { 54 //console.log("Lazyload ->"); 55 LazyLoad.prototype.init(); 56 }); 57})(window.app);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.