Flickity slider with shopify liquid with add initialIndex from shopify theme code

Shopify Expert
126 6 12

I used the Flickity slider with Shopify theme now I want to add initialIndex on my code

my liquid code


<div class="carousel" data-flickity='{ "initialIndex": 7, "adaptiveHeight": false, "freeScroll":true, "cellAlign": "left", "groupCells": "66%", "contain": true, "pageDots":false, "arrowShape": { "x0": 10,"x1": 70, "y1": 50,"x2": 80, "y2": 40,"x3": 35} }'>
{% for block in section.blocks %}
<div class="carousel-cell {% if page.url == block.settings.cs-m-u %}is-active-cs-mmenu{% endif %}" >
<a data-atrib-index= " {{ forloop.index }}" class="cs-icon-link {% if page.url == block.settings.cs-m-u %}active-cs-menu{% endif %}" href="{{ block.settings.cs-m-u }}">
<span class="cd-menut-icon">
{{ block.settings.cs-m-svg }}
<span class="contact-text">{{block.settings.cs-m-tx}}</span>
{% endfor %}

initialIndex": 7, i want to add based on the data-atrib-index= " {{ forloop.index }}" " this show the for loop active index so this value I need to add into Flickity data-flickity= how I can do that"

If you find our comment helpful, hit the like button and accept it as a solution.
Want us to implement custom changes in your store? Contact us
Email me directly - jim@avidbrio.com