Last active
April 1, 2022 18:53
-
-
Save amissak/d57434c52f2d7b4bf7118840a6dc36ad to your computer and use it in GitHub Desktop.
liquid product carousel
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div id="my-keen-slider" class="keen-slider mobile__slider"> | |
{%- if product.selected_or_first_available_variant.featured_media != null -%} | |
{%- assign featured_media = product.selected_or_first_available_variant.featured_media -%} | |
<img lazy="loading" {% if product.selected_or_first_available_variant.featured_media.alt != blank and product.selected_or_first_available_variant.featured_media.alt != featured_media.alt %}style="display: none"{% endif %} data-thumbnail-color="{{featured_media.alt}}" {% if product.selected_or_first_available_variant.featured_media.alt != blank and product.selected_or_first_available_variant.featured_media.alt != featured_media.alt %}class=""{% else %}class="test"{% endif %} src="{{ featured_media | image_url: width: 1946 }}" alt="{{ featured_media.preview_image.alt | escape }}"> | |
{%- endif -%} | |
{%- for media in product.media -%} | |
{%- unless media.id == product.selected_or_first_available_variant.featured_media.id -%} | |
<img lazy="loading" {% if product.selected_or_first_available_variant.featured_media.alt != blank and product.selected_or_first_available_variant.featured_media.alt != media.alt %}style="display: none"{% endif %} data-thumbnail-color="{{media.alt}}" {% if product.selected_or_first_available_variant.featured_media.alt != blank and product.selected_or_first_available_variant.featured_media.alt != media.alt %}class=""{% else %}class="test"{% endif %} src="{{ media | image_url: width: 1946 }}" alt="{{ media.preview_image.alt | escape }}"> | |
{%- endunless -%} | |
{%- endfor -%} | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment