Why thumbnail is not sliding while the variant is selected and Image also come? My client have stiletto theme installed on store as you can see that the slider is not scrolling automatically when one variant is selected as it reflects to bad user experience that’s why He want thumbnail slider to scroll automatically when certain variant image is selected. Store is here https://www.solorugs.com/collections/best-sellers/products/variation-s3386
I want automatically scroll images on desktop version only as it is already ok on mobile version. My client is asking me to please change this first then I will accept delivery Please help me in this.
As current variant is selected but the left carousel of thumbnail does not move/slide
My Slider is not working Properly on Desktop. My concern is that when I select Particular variant my Images Donot Slide automatically to that Particular image of variant. You please suggest me code for this Function. Slider donot comes when I select Particular variant.
You may try adding code like this somewhere in the onOptionChange function:
document.querySelector('.product-thumbnails__item .active')
.scrollIntoView({block:'center'});
Hard to be more specific since the theme.min.js code is minified…
If you do not have unminified version of this file try searching for
y(t, "active")
and modifying to
y(t, "active"), t.scrollIntoView({block:'center'})
but make a theme copy first for backup.
/*
Generated time: September 7, 2023 18:08
This file was created by the app developer. Feel free to contact the original developer with any questions. It was minified (compressed) by AVADA. AVADA do NOT own this script.
*/
document.addEventListener(“product:variant-change”, function (evt) {
document.querySelector(‘.product-thumbnails__item .active’)
.scrollIntoView({block:‘center’});
}); I have added this code in custom-events.aio.min.js as per according to theme documentation how to add custom events but it works in reverse when we select black it takes slider to white images and when we select white it takes to black imagee
Yes, using their event system is a good idea.
It shows wrong thumbnail because this code runs before theme JS re-assigns ‘active’ class to the proper new thumb.
Try this – just adding some delay before executing to allow theme JS to do its work:
document.addEventListener("product:variant-change", function (evt) {
setTimeout(()=> {
document.querySelector('.product-thumbnails__item .active')
.scrollIntoView({block:'center'});
}, 50);
});
Now One thing is Remaining the border on active thumbnail is not showing