Unique ID for slideshow (3 slides)

AntonC
Excursionist
55 1 1

Hi

I am trying to create a unique ID for each slide as 'IF' statement runs, anyone know if liquid has a loopindex so that I can create an ID for each slide that I can then target in javascript?

{% if block.settings.image.size > 0 %}
<div data-mappingkey="mapkey{{ loopindex }}" class="img_placeholder__wrap img_placeholder__{{ section.settings.slideshow_height }}" style="background-image: url( {{ block.settings.image | img_url: img_size, crop: block.settings.img_alignment }} );"></div>
{% else %}

as en E.G

so mapkey{{ loopindex }} would return (1) or (2) or (3)  etc etc

0 Likes