Created
February 28, 2023 22:46
-
-
Save ihorduchenko/601df6de85d90ac1412aece50941ecee to your computer and use it in GitHub Desktop.
Shopify images focal points usage example
This file contains hidden or 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
{%- if section.settings.main_image != blank -%} | |
{%- assign focal_point = section.settings.main_image.presentation.focal_point -%} | |
{%- capture focal_point_css -%} | |
{%- if focal_point != blank -%} | |
style="object-position:{{ focal_point.x }}% {{ focal_point.y }}%;" | |
{%- endif -%} | |
{%- endcapture -%} | |
<div class="collection-banner--img img-cover"> | |
<img class="lazyload" data-src="{{ section.settings.main_image | img_url: 'master' }}" alt="Banner" {{ focal_point_css }}> | |
</div> | |
{%- endif -%} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment