DARMOWA DOSTAWA DLA ZAMÓWIEŃ OD 300PLN!

document.addEventListener("DOMContentLoaded", function() { function applyLazyLoading(images) { images.forEach(function(img) { if (!img.getAttribute("loading")) { img.setAttribute("loading", "lazy"); } }); } const staticImages = document.querySelectorAll("img:not(:first-of-type)"); applyLazyLoading(staticImages); const intersectionObserver = new IntersectionObserver(function(entries) { entries.forEach(function(entry) { if (entry.isIntersecting) { const img = entry.target; if (img.dataset.src) { img.src = img.dataset.src; } img.setAttribute("loading", "lazy"); intersectionObserver.unobserve(img); } }); }, { rootMargin: "200px 0px" }); const mutationObserver = new MutationObserver(function() { const ecwidImages = document.querySelectorAll( ".grid-product__image img, .product-details img, .details-gallery img" ); ecwidImages.forEach(function(img) { if (!img.getAttribute("loading")) { intersectionObserver.observe(img); } }); }); mutationObserver.observe(document.body, { childList: true, subtree: true }); });