Shopify themes, liquid, logos, and UX
Hello everyone 🙂
I'm working on a Shopify store and am stuck on an issue. Can anyone please help?
I want the product image to automatically change like a slider on the product page. Is there any solution for this? If you can provide the code, I would highly appreciate it.
Store URL: Foodease.ai
Password: 1234
<script>
document.addEventListener("DOMContentLoaded", function () {
let thumbnails = document.querySelectorAll(".product__thumb-item");
let mainPhoto = document.querySelector(".product__main-photos img");
let currentIndex = 0;
function changeImage() {
thumbnails.forEach(thumb => thumb.classList.remove("active"));
let currentThumb = thumbnails[currentIndex];
currentThumb.classList.add("active");
let newImagesrc=currentThumb.querySelector("img").src;
mainPhoto.src=newImageSrc;
currentIndex = (currentIndex + 1) % thumbnails.length;
}
setInterval(changeImage, 3000);
});
</script>
Then add this code before <head> https://prnt.sc/jxdXC3UhhWxf
{% style %}
.product__thumb-item.active {
border: 2px solid #ff6600;
opacity: 1;
}
.product__thumb-item img {
opacity: 0.6;
transition: opacity 0.3s ease-in-out;
}
.product__thumb-item.active img {
opacity: 1;
}
{% endstyle %}
I hope this helps
Best,
Daisy
Hello @DaisyVo Thank you for replying. However, this solution is not working. Could you please check again and try to help? I would highly appreciate your assistance.
Can you take a picture of where you added the code?
June brought summer energy to our community. Members jumped in with solutions, clicked ...
By JasonH Jun 5, 2025Learn how to build powerful custom workflows in Shopify Flow with expert guidance from ...
By Jacqui May 7, 2025Did You Know? May is named after Maia, the Roman goddess of growth and flourishing! ...
By JasonH May 2, 2025