{% liquid assign block = section.blocks | where: 'type', 'media_gallery' | first assign current_variant = product.selected_or_first_available_variant if current_variant.featured_image assign initial_slide = product.selected_or_first_available_variant.featured_media.position | minus: 1 else assign initial_slide = 0 endif %} {% if product == nil %} {{ 'image' | placeholder_svg_tag: 'img-thumbnail' }} {% elsif block != nil %}
{% for media in product.media %} {% liquid assign media_loading = 'eager' if forloop.index > 2 assign media_loading = 'lazy' endif %}
{% case media.media_type %} {% when 'image' %} {% render 'image-url', img: media, size: 800, orientation: block.settings.img_orientation, loading: media_loading, class: '' %} {% when 'video' %} {{ media | video_tag: controls: true, image_size: '800x', loading: media_loading, class: 'bg-black w-100' }} {% endcase %}
{% endfor %}
{% render 'svg-icons', icon: 'chevron-left', size: 24 %}
{% render 'svg-icons', icon: 'chevron-right', size: 24 %}
{% for media in product.media %}
{% case media.media_type %} {% when 'image' %} {% render 'image-url', img: media, size: 800, orientation: settings.product_img_orientation, class: 'img-thumbnail' %} {% when 'video' %} {% render 'svg-icons', icon: 'play', size: '18', aria-hidden: 'true' %} {% render 'image-url', img: media.preview_image, size: 800, orientation: settings.product_img_orientation, class: 'img-thumbnail' %} {% endcase %}
{% endfor %}
{% endif %}