How to limit loop for media?

Topbright
Excursionist
27 4 4

Hello, I need help with 2 issues that I don't know how to do right, first, it's to get the loop index for all media (image, video, external video, 3D)

the second one is how to limit the loop for the first one when we use media for the video only

// First Issue
// I want to get index for each image, videos, exernal_video and model by 1, 2, 3, 4, 5, 6, 7, 8.... by order

// Second Issue
{% for media in product.media %}
{% case media.media_type %}
{% when 'image' %}
// All images
{% when 'video' %}
// How to get only first video?
{% when 'external_video' %}
// ...
{% when 'model' %}
// ...
{% endcase %}
{% endfor %}

 

Website: https://www.topbrighttoys.com/products/120519g

0 Likes
EyeR
Tourist
36 3 5