@ASVN2
Posted
You can fix one problem between these I sow that one when you click on the small image of product it's active but the previous one it's still active to you can fix that by remove the active class from all when you click and add it on the clicked on the clicked on it
------------------------Code-----------
// array of small under in perview images
const smallImages = document.querySelectorAll(".image img");
// here you just for on the image and active the one that clicked
smallImages.forEach((image) => {
image.addEventListener("click", () => {
image.classList.add("active");
});
});
// the same but here we will remove the active from the prev one
smallImages.forEach((image) => {
image.addEventListener("click", () => {
smallImages.forEach((image) => {
image.classList.remove("active");
});
image.classList.add("active");
});
});