Hello, i modified my code so i can move product images with arrow keys, its working fine, i can move with arrow key, click it manually, and the thumbnail highlight is also following the arrow keys.
But the problem is, after i pick the variant, the preview image is show two images, and it fix the issue if i click the thumbnail manually.
Please help, this is the website
And this is the code for product gallery: https://n9layg256hgz8hfx-886341698.shopifypreview.com
{% assign selected_variant = product.selected_or_first_available_variant %}
{% assign selected_media = selected_variant.featured_media | default: product.featured_media %}
{% case media.media_type %}
{% when ‘image’ %}
{% assign scale = 1 %}
{% if enable_zoom %}
{% assign scale = 1.5 %}
{% endif %}
{%
render ‘rimg’,
img: media,
size: ‘x700’,
scale: scale,
lazy: true
%}
{% when ‘external_video’ %}
{{ media | media_tag: image_size: ‘1024x’ }}
{% when ‘model’ %}
{{ media | model_viewer_tag: image_size: ‘1024x’, reveal: ‘interaction’ , toggleable: true, interaction-prompt-threshold: 0 }}
<img
src=“{{ media.preview_image | img_url: ‘1024x’ }}”
alt=“{{ media.preview_image.alt | escape }}”
width=“{{ media.preview_image.width }}”
height=“{{ media.preview_image.height }}”
loading=“lazy”
{% assign first_model = product.media | where: “media_type”, “model” | first %}
{% if selected_media.media_type == ‘model’ %}
{% assign model = selected_media %}
{% else %}
{% assign model = first_model %}
{% endif %}
{% if model %}
<button
class=“product-gallery–viewinyourspace”
data-default-model-id=“{{ first_model.id }}”
data-shopify-xr
data-shopify-model3d-id=“{{ model.id }}”
data-shopify-title=“{{ product.title }}”
data-shopify-xr-hidden
{% render ‘icon-library’, id: ‘icon-3D’ %}
{{ ‘product.media.view_in_your_space’ | t }}
{% endif %}
{% if product.media.size > 1 %}