Hi everyone,
Currently on the Horizon theme if you hover over a product image it changes the image to the second image for the product. I want to lock it in on the first image. How do I accomplish this? I still want to be able to use the left and right arrows on the product image to cycle through the images, I just don’t want it to automatically change to the second image on hover.
Thanks,
Parker
2 Likes
Yeah I might be new here but I wasn’t born yesterday lol
1 Like
Hi @prhinson ,
You can do this by adding the following code to Custom CSS in Sales Channels > Online Store > Themes > Customize > Theme Settings (Cog Icon) > Custom CSS
.product-grid__item slideshow-slide[style*="--slide-2"] {
display: none !important;
}
Hope that helps!
Here’s the solution I found in case anyone else finds this thread. Using the Horizon theme, find assets/product-card.js. From line 252-282 I saw this:
/**
* Previews the next image.
* {PointerEvent} event - The pointer event.
*/
previewImage(event) {
const { slideshow } = this.refs;
if (!slideshow || event.pointerType !== 'mouse') return;
this.resetVariant.cancel();
if (this.#previousSlideIndex != null && this.#previousSlideIndex > 0) {
slideshow.select(this.#previousSlideIndex, undefined, { animate: false });
} else {
slideshow.next(undefined, { animate: false });
setTimeout(() => this.#preloadNextPreviewImage());
}
}
/**
* Resets the image to the variant image.
*/
resetImage() {
const { slideshow } = this.refs;
if (!this.variantPicker) {
if (!slideshow) return;
slideshow.previous(undefined, { animate: false });
} else {
this.#resetVariant();
}
}
So I replaced the above code with this new code below:
/**
* Previews the next image.
* {PointerEvent} event - The pointer event.
*/
previewImage(event) {
// Disabled intentionally to prevent hover image preview
}
/**
* Resets the image to the variant image.
*/
resetImage() {
// Intentionally disabled to prevent image reset on hover out
}