function productGridSlider(){const allProducts=document.querySelectorAll(".grid__item");allProducts.length>0&&allProducts.forEach(product=>{let allProductsImages=product.getAttribute("data-images");const prevButton=product.querySelector(".prevButton"),nextButton=product.querySelector(".nextButton");let imagesArray;if(allProductsImages&&(imagesArray=allProductsImages.split(","),imagesArray.pop()),imagesArray&&imagesArray.length>1){let updateImage2=function(){const imageElement=product.querySelector(".grid__item img"),updatedImages=product.querySelector(".color__swatches-swatch.active");updatedImages&&(imagesArray=[],imagesArray=updatedImages.getAttribute("data-productimages"),imagesArray=imagesArray.split(","),imagesArray.pop());const currentImage=imagesArray[currentIndex];imageElement.src=currentImage,imageElement.hasAttribute("srcset")&&(imageElement.srcset=currentImage)},onNextClick2=function(){imagesArray.length<=1||(currentIndex++,currentIndex>=imagesArray.length&&(currentIndex=0),updateImage2())},onPrevClick2=function(){imagesArray.length<=1||(currentIndex--,currentIndex<0&&(currentIndex=imagesArray.length-1),updateImage2())};var updateImage=updateImage2,onNextClick=onNextClick2,onPrevClick=onPrevClick2;let currentIndex=0;prevButton&&prevButton.addEventListener("click",onPrevClick2),nextButton&&nextButton.addEventListener("click",onNextClick2)}})}productGridSlider(); //# sourceMappingURL=/cdn/shop/t/25/assets/product-grid-slider.js.map?ignore_redirect=1