File "lazyLoading.min.js"

Full Path: /home/ycoalition/public_html/blog/wp-content/themes/woodmart/js/scripts/global/lazyLoading.min.js
File size: 2.79 KB
MIME-type: text/plain
Charset: utf-8

!function(d){woodmartThemeModule.$document.on("wdHiddenSidebarsInited",function(){woodmartThemeModule.lazyLoading()}),d.each(["frontend/element_ready/wd_products.default","frontend/element_ready/wd_products_tabs.default","frontend/element_ready/wd_product_categories.default","frontend/element_ready/wd_products_brands.default","frontend/element_ready/wd_blog.default","frontend/element_ready/wd_images_gallery.default","frontend/element_ready/wd_product_categories.default","frontend/element_ready/wd_slider.default","frontend/element_ready/wd_banner_carousel.default","frontend/element_ready/wd_banner.default","frontend/element_ready/wd_infobox_carousel.default","frontend/element_ready/wd_infobox.default","frontend/element_ready/wd_instagram.default","frontend/element_ready/wd_testimonials.default"],function(e,t){woodmartThemeModule.wdElementorAddAction(t,function(){woodmartThemeModule.lazyLoading()})}),woodmartThemeModule.lazyLoading=function(){var r,l,e;function t(){e=e||setTimeout(function(){e=null,o()},100)}function o(){r.length&&requestAnimationFrame(function(){for(var e,t,o=parseInt(woodmart_settings.lazy_loading_offset),d=window.pageYOffset,n=d+window.innerHeight+o,a=0;a<r.length;)d<(t=d+(e=r[a].getBoundingClientRect()).top)+e.height&&t<n&&!r[a].loaded?function(t){t.onload=e,null!==t.querySelector("img")&&(t.querySelector("img").onload=e,t.querySelector("img").src=t.dataset.woodSrc,t.querySelector("source").srcset=t.dataset.woodSrc,void 0!==t.dataset.srcset&&(t.querySelector("img").srcset=t.dataset.srcset));t.src=t.dataset.woodSrc,void 0!==t.dataset.srcset&&(t.srcset=t.dataset.srcset);function e(){requestAnimationFrame(function(){t.classList.add("wd-loaded");var e=jQuery(t).parents(".view-masonry .gallery-images, .grid-masonry, .masonry-container"),e=(0<e.length&&e.isotope("layout"),jQuery(t).parents(".categories-masonry"));0<e.length&&e.packery()})}t.loaded=!0}(r[a]):a++;l=r.length})}window.addEventListener&&window.requestAnimationFrame&&document.getElementsByClassName&&(r=document.getElementsByClassName("wd-lazy-load"),woodmartThemeModule.$document.on("wood-images-loaded added_to_cart updated_checkout",function(){o()}),woodmartThemeModule.$body.on("click",".wd-header-mobile-nav > a, .wd-nav-opener, .wd-btn-show-cat",function(){woodmartThemeModule.$document.trigger("wood-images-loaded")}),d(".wd-scroll-content").on("scroll",function(){woodmartThemeModule.$document.trigger("wood-images-loaded")}),d(".wc-tabs > li").on("click",function(){woodmartThemeModule.$document.trigger("wood-images-loaded")}),window.addEventListener("scroll",t,!1),window.addEventListener("resize",t,!1),MutationObserver&&new MutationObserver(function(){r.length!==l&&o()}).observe(document.body,{subtree:!0,childList:!0,attributes:!0,characterData:!0}),o())},d(document).ready(function(){woodmartThemeModule.lazyLoading()})}(jQuery);