Shopify themes, liquid, logos, and UX
Hello,
I wanted to have different banners for mobile and desktop on the minimal theme, so created two custom sections: desktop banner & mobile banner.
What I want to do next is to make them clickable, currently my desktop banner.liquid code under sections looks as follows:
{% if block.settings.image_link != blank %}
<a href="{{ block.settings.image_link }}">
{% endif %}
<div class="page-width yx-desktop-banner-container yx-mobile-hidden">
<div class="container-full">
{% for block in section.blocks limit: 1 %}
<img class="img-responsive lazyload" data-src="{{ block.settings.yx_image_picker | img_url: '2000x' }}" />
{% endfor %}
</div>
</div>
{% schema %}
{
"name": "YX Desktop Banner",
"class": "yx-desktop-banner-section",
"max_blocks": 1,
"blocks": [
{
"type": "image_picker",
"name": "Desktop Banner Image",
"settings": [
{
"label": "Desktop Banner Image",
"id": "yx_image_picker",
"type": "image_picker"
}
]
}
],
"presets": [
{
"name": "YX Desktop Banner",
"category": "Home",
"blocks":[{"type" : "image_picker"}]
}
]
}
{% endschema %}
{% stylesheet %}
{% endstylesheet %}
{% javascript %}
{% endjavascript %}
{% if section.settings.desktop_image != blank and section.settings.mobile_image != blank %}
<div class="banner-container">
<a href="YOUR_REDIRECTION_LINK_HERE">
<img class="yx-mobile-hidden" src="{{ section.settings.desktop_image | img_url: "master" }}">
<img class="yx-desktop-hidden" src="{{ section.settings.mobile_image | img_url: "master" }}">
</a>
</div>
{% endif %}
Can you please tell me where I should insert the relevant code to make these banners clickable?
Many thanks,
Solved! Go to the solution
This is an accepted solution.
thanks i have done pleas check also if same issue used below code
yx-desktop-banner.liquid
{% if block.settings.image_link != blank %}
<a href="{{ block.settings.image_link }}">
{% endif %}
<div class="page-width yx-desktop-banner-container yx-mobile-hidden">
<div class="container-full">
{% for block in section.blocks limit: 1 %}
<a href="{{ block.settings.button_link }}" class="slides__image-link">
<img class="img-responsive lazyload" data-src="{{ block.settings.yx_image_picker | img_url: '2000x' }}" />
</a>
{% endfor %}
</div>
</div>
{% schema %}
{
"name": "YX Desktop Banner",
"class": "yx-desktop-banner-section",
"max_blocks": 1,
"blocks": [
{
"type": "image_picker",
"name": "Desktop Banner Image",
"settings": [
{
"label": "Desktop Banner Image",
"id": "yx_image_picker",
"type": "image_picker"
},
{
"type": "url",
"id": "button_link",
"label": "Image Link Desktop"
}
]
}
],
"presets": [
{
"name": "YX Desktop Banner",
"category": "Home",
"blocks":[{"type" : "image_picker"}]
}
]
}
{% endschema %}
{% stylesheet %}
{% endstylesheet %}
{% javascript %}
{% endjavascript %}
yx-mobile-banner.liquid
<div class="page-width yx-mobile-banner-container yx-desktop-hidden">
<div class="container-full">
{% for block in section.blocks limit: 1 %}
<a href="{{ block.settings.button_link }}" class="slides__image-link">
<img class="img-responsive lazyload" data-src="{{ block.settings.yx_image_picker | img_url: '750x' }}" />
</a>
{% endfor %}
</div>
</div>
{% schema %}
{
"name": "YX Mobile Banner",
"class": "yx-mobile-banner-section",
"max_blocks": 1,
"blocks": [
{
"type": "image_picker",
"name": "Mobile Banner Image",
"settings": [
{
"label": "Mobile Banner Image",
"id": "yx_image_picker",
"type": "image_picker"
},
{
"type": "url",
"id": "button_link",
"label": "Image Link Mobile"
}
]
}
],
"presets": [
{
"name": "YX Mobile Banner",
"category": "Home",
"blocks":[{"type" : "image_picker"}]
}
]
}
{% endschema %}
{% stylesheet %}
{% endstylesheet %}
{% javascript %}
{% endjavascript %}
This is an accepted solution.
its my pleasure to help us
This is an accepted solution.
Hello again @KetanKumar , I would as well like to make those banners full width on mobile and desktop view. Any possibility you could help me with that too? Or should I post that request under another topic? Many thanks in advance,
This is an accepted solution.
yes, please add this code
1. Go to Online Store->Theme->Edit code
2. Asset->/timber.scss.liquid->paste below code at the bottom of the file.
.template-index .main-content {
max-width: 100%;
padding: 0;
}
.template-index .main-content .shopify-section {
max-width: 1340px;
margin: 0px auto;
padding: 0px 30px;
}
#shopify-section-1648652706e27ed3c0, #shopify-section-1648652701e885f30f {
max-width: 100% !important;
padding: 0px !important;
}
its mix up your code if possible to give me theme access so i will quick fix
Hello,
thanks for reaching out! what's your email address?
sounds good
- Feel free to contact me on bamaniyaketan.sky@gmail.com regarding any help
Hello,
Just sent you the invite. There are two liquid codes:yx-desktop-liquid & yx-mobile-liquid
This is an accepted solution.
thanks i have done pleas check also if same issue used below code
yx-desktop-banner.liquid
{% if block.settings.image_link != blank %}
<a href="{{ block.settings.image_link }}">
{% endif %}
<div class="page-width yx-desktop-banner-container yx-mobile-hidden">
<div class="container-full">
{% for block in section.blocks limit: 1 %}
<a href="{{ block.settings.button_link }}" class="slides__image-link">
<img class="img-responsive lazyload" data-src="{{ block.settings.yx_image_picker | img_url: '2000x' }}" />
</a>
{% endfor %}
</div>
</div>
{% schema %}
{
"name": "YX Desktop Banner",
"class": "yx-desktop-banner-section",
"max_blocks": 1,
"blocks": [
{
"type": "image_picker",
"name": "Desktop Banner Image",
"settings": [
{
"label": "Desktop Banner Image",
"id": "yx_image_picker",
"type": "image_picker"
},
{
"type": "url",
"id": "button_link",
"label": "Image Link Desktop"
}
]
}
],
"presets": [
{
"name": "YX Desktop Banner",
"category": "Home",
"blocks":[{"type" : "image_picker"}]
}
]
}
{% endschema %}
{% stylesheet %}
{% endstylesheet %}
{% javascript %}
{% endjavascript %}
yx-mobile-banner.liquid
<div class="page-width yx-mobile-banner-container yx-desktop-hidden">
<div class="container-full">
{% for block in section.blocks limit: 1 %}
<a href="{{ block.settings.button_link }}" class="slides__image-link">
<img class="img-responsive lazyload" data-src="{{ block.settings.yx_image_picker | img_url: '750x' }}" />
</a>
{% endfor %}
</div>
</div>
{% schema %}
{
"name": "YX Mobile Banner",
"class": "yx-mobile-banner-section",
"max_blocks": 1,
"blocks": [
{
"type": "image_picker",
"name": "Mobile Banner Image",
"settings": [
{
"label": "Mobile Banner Image",
"id": "yx_image_picker",
"type": "image_picker"
},
{
"type": "url",
"id": "button_link",
"label": "Image Link Mobile"
}
]
}
],
"presets": [
{
"name": "YX Mobile Banner",
"category": "Home",
"blocks":[{"type" : "image_picker"}]
}
]
}
{% endschema %}
{% stylesheet %}
{% endstylesheet %}
{% javascript %}
{% endjavascript %}
Thank you sooo so much!!!!
This is an accepted solution.
its my pleasure to help us
This is an accepted solution.
Hello again @KetanKumar , I would as well like to make those banners full width on mobile and desktop view. Any possibility you could help me with that too? Or should I post that request under another topic? Many thanks in advance,
oh sorry please show me issue?
sorry i can't see your attachment
Hello again @KetanKumar , I attached the screenshots again, I would like to make them full width. Any possibility you could help? many thanks,
my website link is kybeleconcept.com
please confirm this look
Hello, confirmed.
desktop and mobile right?
yes, for both. thanks so much in advance!
This is an accepted solution.
yes, please add this code
1. Go to Online Store->Theme->Edit code
2. Asset->/timber.scss.liquid->paste below code at the bottom of the file.
.template-index .main-content {
max-width: 100%;
padding: 0;
}
.template-index .main-content .shopify-section {
max-width: 1340px;
margin: 0px auto;
padding: 0px 30px;
}
#shopify-section-1648652706e27ed3c0, #shopify-section-1648652701e885f30f {
max-width: 100% !important;
padding: 0px !important;
}
thank you so mcuh!
its my pleasure to help us
User | RANK |
---|---|
69 | |
65 | |
64 | |
53 | |
49 |
We're excited to announce improvements to the threaded messaging experience in our communi...
By TyW May 31, 2023Thank you to everyone who participated in our AMA with Klaviyo. It was great to see so man...
By Jacqui May 30, 2023Photo by Marco Verch Sales channels on Shopify are various platforms where you can sell...
By Ollie May 25, 2023