How do I add an image block within an image banner section in Dawn?
URL: www.sunshinefoodsuk.com / pass:sunshine
A user asks how to add an image block above the title within Dawn theme’s Image Banner section, rather than just changing the background.
Solution provided involves two steps:
Technical details:
{%- if block.settings.heading != blank -%}Follow-up issues:
The discussion remains open with unresolved implementation questions from multiple users attempting the solution.
How do I add an image block within an image banner section in Dawn?
Hi,
Please add the code below to Assets > component-slideshow.css file.
@media screen and (min-width: 750px) {
.slideshow__text.banner__box.content-container.content-container--full-width-mobile.color-accent-2.gradient.slideshow__text--center.slideshow__text-mobile--center {
background: url(https://cdn.shopify.com/s/files/Your_PC_Image_File.jpg);
background-position: center;
background-size: contain;
background-repeat: repeat;
}
}
@media screen and (max-width: 749px) {
.slideshow__text.banner__box.content-container.content-container--full-width-mobile.color-accent-2.gradient.slideshow__text--center.slideshow__text-mobile--center {
background: url(https://cdn.shopify.com/s/files/Your_Mobile_Image_File.jpg);
background-position: center;
background-size: contain;
background-repeat: repeat;
}
}
Please change the full URL of the background image per your needs.
The top part is for PC and the bottom part is for mobile.
The image will be applied to all content block (all slideshow images).
Hope it helps.
Hi David, this solution changes the background from a solid colour to a repeated image. I want to add an image block that sits above the title.
Hi,
I thought you wanted the background for the content box.
If you want to add an image, you need to edit the slideshow.liquid file.
Please follow the steps below.
Go to Sections > slideshow.liquid file.
Find (ctrl+F) —> {%- if block.settings.heading != blank -%}
Before the code {%- if block.settings.heading != blank -%}, add the code below.
{% comment %} Special Image above the title Start {% endcomment %}
{% if block.settings.sp_image != blank %}
{% endif %}
{% comment %} Special Image above the title End {% endcomment %}
It will be as below.
{
"type": "image_picker",
"id": "sp_image",
"label": "Special Image",
"info": "Add special image above the title"
},
{
"type": "range",
"id": "sp_image_width",
"min": 50,
"max": 300,
"step": 5,
"unit": "px",
"label": "Special image width",
"default": 100
},
{
"type": "range",
"id": "sp_image_bottom",
"min": 0,
"max": 100,
"step": 2,
"unit": "px",
"label": "Special image bottom margin",
"default": 12
},
Save the file.
Go to Customize the theme.
In the block, you will see an image picker, image size (width), and bottom margin of the image.
Before you edit the code, please make a BACKUP copy of your theme!!!
If you were unable to edit the code, please send me a PM.
Hope it helps.
Thanks, I’ll give it a try.
Hey @DavidEKim I’ve added the mobile block to the Assets > component-slideshow.css file, but am not seeing any changes when viewing on mobile.
link is here: https://q2lu1kdx2wt3u5hr-55863771214.shopifypreview.com/pages?preview_key=114e442afe24bed01d004d9a454aa730
I’m just basically wanting the event logo to sit on top of the image.
Good Afternoon David,
I have attempted to implement your solution, but do not see any changes or new options in the banner block. I see some differences in my liquid vs your screenshots, perhaps they updated it? Thank you so much for your help.