Created
September 25, 2019 07:19
-
-
Save shopifypartners/bde45cb27ef36d430c563e1afdd7b248 to your computer and use it in GitHub Desktop.
How to use Shopify theme settings to create mobile-specific logos |
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="desktop"> | |
{% if section.settings.logo != blank %} | |
{% capture image_size %}{{ section.settings.logo_max_width }}x{% endcapture %} | |
<img src="{{ section.settings.logo | img_url: image_size }}" | |
srcset="{{ section.settings.logo | img_url: image_size }} 1x, {{ section.settings.logo | img_url: image_size, scale: 2 }} 2x" | |
alt="{{ section.settings.logo.alt | default: shop.name }}"> | |
{% else %} | |
{{ shop.name }} | |
{% endif %} | |
</div> | |
<div id="mobile"> | |
{% if section.settings.mobile_logo != blank %} | |
{% capture image_size %}{{ section.settings.mobile_logo_max_width }}x{% endcapture %} | |
<img src="{{ section.settings.mobile_logo | img_url: image_size }}" | |
srcset="{{ section.settings.mobile_logo | img_url: image_size }} 1x, {{ section.settings.mobile_logo | img_url: image_size, scale: 2 }} 2x" | |
alt="{{ section.settings.logo.alt | default: shop.name }}"> | |
{% else %} | |
{{ shop.name }} | |
{% endif %} | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment