pull/1/head
Jan Umbach 2024-05-30 09:59:33 +02:00
parent 928989f4ce
commit bf809ca003
2 changed files with 28 additions and 17 deletions

View File

@ -72,10 +72,13 @@
{% comment %}theme-check-enable ImgLazyLoading{% endcomment %}
{%- if card_product.media[1] != null and show_secondary_image -%}
{%- echo card_product.media[1] | media_tag: image_size: "2048x", autoplay: true, loop: true, controls: false, preload: "none", class: "motion-reduce" -%}
{% comment %}
{% if card_product.media[1].media_type == 'video' %}
{% render 'shx-video'
, media: card_product.media[1]
, videoType: 'card_product' %}
{% else %}
<img
srcset="
srcset="
{%- if card_product.media[1].width >= 165 -%}{{ card_product.media[1] | image_url: width: 165 }} 165w,{%- endif -%}
{%- if card_product.media[1].width >= 360 -%}{{ card_product.media[1] | image_url: width: 360 }} 360w,{%- endif -%}
{%- if card_product.media[1].width >= 533 -%}{{ card_product.media[1] | image_url: width: 533 }} 533w,{%- endif -%}
@ -84,15 +87,14 @@
{%- if card_product.media[1].width >= 1066 -%}{{ card_product.media[1] | image_url: width: 1066 }} 1066w,{%- endif -%}
{{ card_product.media[1] | image_url }} {{ card_product.media[1].width }}w
"
src="{{ card_product.media[1] | image_url: width: 533 }}"
sizes="(min-width: {{ settings.page_width }}px) {{ settings.page_width | minus: 130 | divided_by: 4 }}px, (min-width: 990px) calc((100vw - 130px) / 4), (min-width: 750px) calc((100vw - 120px) / 3), calc((100vw - 35px) / 2)"
alt=""
class="motion-reduce"
loading="lazy"
width="{{ card_product.media[1].width }}"
height="{{ card_product.media[1].height }}"
>
{% endcomment %}
src="{{ card_product.media[1] | image_url: width: 533 }}"
sizes="(min-width: {{ settings.page_width }}px) {{ settings.page_width | minus: 130 | divided_by: 4 }}px, (min-width: 990px) calc((100vw - 130px) / 4), (min-width: 750px) calc((100vw - 120px) / 3), calc((100vw - 35px) / 2)"
alt=""
class="motion-reduce"
loading="lazy"
width="{{ card_product.media[1].width }}"
height="{{ card_product.media[1].height }}">
{%- endif -%}
{%- endif -%}
</div>
</div>

View File

@ -1,9 +1,18 @@
{% assign videoType = videoType | default "normal" %}
{% assign media = media %}
{% if video_src != 'none' %}
<div class="shx-video">
<div class="shx-video__wrapper">
{%- echo media | media_tag: image_size: "2048x", autoplay: true, loop: true, controls: false, preload: "none" -%}
{% if videoType == "normal" %}
{% if video_src != 'none' %}
<div class="shx-video">
<div class="shx-video__wrapper">
{%- echo media | media_tag: image_size: "2048x", autoplay: true, loop: true, controls: false, preload: "none" -%}
</div>
</div>
</div>
{% endif %}
{% elsif videoType == "card_product" %}
{%- echo media | media_tag: image_size: "2048x", autoplay: false, loop: true, controls: false, preload: "none" -%}
{% endif %}