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) • 636 B
JavaScript
import{setBackground as t,setMultiBackground as o,setImgsetBackground as r,setSources as m,setSourcesNative as e}from"./set.js";import{setStatus as i}from"./data.js";import{hasLoadEvent as s,addOneShotEventListeners as p}from"./event.js";import{statusNative as a}from"./elementStatus.js";import{addTempImage as f}from"./tempImage.js";import{saveOriginalBackgroundStyle as j}from"./originalAttributes.js";const n=(e,i,a)=>{s(e)?((t,o,r)=>{p(t,o,r),m(t,o,r)})(e,i,a):((m,e,i)=>{f(m),p(m,e,i),j(m),t(m,e,i),o(m,e,i),r(m,e,i)})(e,i,a)},l=(t,o,r)=>{t.setAttribute("loading","lazy"),p(t,o,r),e(t,o),i(t,a)};export{n as load,l as loadNative};