0

need help in slick slider

I am working on venture theme of shopify. i add slick slide like this ' let slickSetings = $(".product-single__thumbnails-product-template").slick("getSlick"); // console.log(slickSetings); $(".product-single__thumbnails-product-template").slick("unslick"); let responseData = await this.fetchResponse(handle); let dataObj = this.productDataObject(responseData.product); this.addImagesOfRespectiveId(idOfImg, dataObj, allLiDiv); document.querySelector(".single-option-selector").addEventListener("change", (eventHandler) => { console.log("hello"); const urlParams = new URLSearchParams(window.location.search); idOfImg = urlParams.get("variant"); this.addImagesOfRespectiveId(idOfImg, dataObj, allLiDiv); }); $(".photos__item--thumbs").slick(slickSetings); ' i am getting wrong ans here , having doubt also that from which class we are removing or destroying slick needs to be same when we reinitialise slick again

1st Sep 2022, 3:30 PM
Siddarth Mewara
1 Respuesta
0
// Initialize Slick slider let slickSettings = { // Your Slick settings here }; let $thumbnailSlider = $(".product-single__thumbnails-product-template"); // Initialize Slick slider $thumbnailSlider.slick(slickSettings); async function updateThumbnailSlider(handle, dataObj, allLiDiv) { $thumbnailSlider.slick("unslick"); // Destroy the slider let responseData = await this.fetchResponse(handle); let newSlickSettings = { // New Slick settings based on responseData, if needed }; // Re-add images this.addImagesOfRespectiveId(idOfImg, dataObj, allLiDiv); // Reinitialize Slick slider with new settings $thumbnailSlider.slick(newSlickSettings); } // Call the function to update slider when option changes document.querySelector(".single-option-selector").addEventListener("change", (eventHandler) => { console.log("Option changed"); const urlParams = new URLSearchParams(window.location.search); let idOfImg = urlParams.get("variant"); updateThumbnailSlider(handle, dataObj, allLiDiv); });
8th Mar 2024, 10:39 PM
Անի Մուրադյան
Անի Մուրադյան - avatar