UNPKG

vanilla-lazyload

Version:

LazyLoad is a lightweight (2.4 kB) and flexible script that speeds up your web application by deferring the loading of your below-the-fold images, videos and iframes to when they will enter the viewport. It's written in plain "vanilla" JavaScript, it leve

2 lines (1 loc) 332 B
const t=function(t,e){let n;const i="LazyLoad::Initialized",o=new t(e);try{n=new CustomEvent(i,{detail:{instance:o}})}catch(t){n=document.createEvent("CustomEvent"),n.initCustomEvent(i,!1,!1,{instance:o})}window.dispatchEvent(n)},e=(e,n)=>{if(n)if(n.length)for(let i,o=0;i=n[o];o+=1)t(e,i);else t(e,n)};export{e as autoInitialize};