1window.addEventListener("load", function (event) { 2 // lazy loads elements with the below selector 3 const observer = lozad('.lazy-raster-combo', { 4 load: function (el) { 5 el.classList.add('lazy-fade-combo') 6 if (el.hasAttribute("data-srcset")) { 7 el.srcset = el.dataset.srcset; 8 } 9 if (el.hasAttribute("data-src")) { 10 el.src = el.dataset.src; 11 } 12 }, 13 loaded: function (el) { 14 // Custom implementation on a loaded element 15 el.classList.add('loaded-combo'); 16 } 17 }); 18 observer.observe(); 19}); 20 21