Dawn theme - Image Banner

Topic summary

A user seeks help customizing the Dawn theme’s image banner component with two main requirements:

Initial Questions:

  • Making the entire image clickable (not just the button)
  • Positioning heading/text/button at the bottom of images in mobile view

Solution Provided:
A developer (@Shadab_dev) shares custom code modifications to image-banner.liquid that:

  • Adds a clickable link setting in the theme customizer for the entire banner section
  • Uses CSS to position content at the bottom on mobile devices
  • Includes JavaScript to handle click events and redirects

Follow-up Issues:

Issue 1 (Resolved): The code made ALL image banners clickable site-wide. Solution: Remove links from the customizer setting on pages where clickability isn’t desired.

Issue 2 (Ongoing): After implementing a separate tutorial for displaying different images on mobile vs. desktop, the mobile image banner link stopped working. The user has requested assistance but no solution has been provided yet.

Status: Partially resolved. The original customization works, but a new compatibility issue with mobile/desktop image switching remains unresolved.

Summarized with AI on October 29. AI used: claude-sonnet-4-5-20250929.

Hi everyone,

Question 1: How do I make the entire image clickable, instead of just relying on the Button block?

Question 2: In the mobile view, how do I position the Heading/Texts and button at the bottom of the image (like in desktop view)?

Thank you in advance!!

Hi @mayami for your first requirement you will have to modify the code a little.

The second one is achievable with a bit of css for mobile version

Hi @Shadab_dev , thank you for replying. Do you have the steps on doing these?

Hi @mayami definitely have the steps. Here it is

Open image-banner.liquid file from your code editor and replace this entire code. Please before making any changes always have a copy of the theme in case anything goes wrong.

.banner .banner__box{ margin-top: auto !important; }

{{ ‘section-image-banner.css’ | asset_url | stylesheet_tag }}

{%- if section.settings.image_height == ‘adapt’ and section.settings.image != blank -%}
{%- style -%}
@media screen and (max-width: 749px) {
#Banner-{{ section.id }}::before,
#Banner-{{ section.id }} .banner__media::before,
#Banner-{{ section.id }}:not(.banner–mobile-bottom) .banner__content::before {
padding-bottom: {{ 1 | divided_by: section.settings.image.aspect_ratio | times: 100 }}%;
content: ‘’;
display: block;
}

}

@media screen and (min-width: 750px) {
#Banner-{{ section.id }}::before,
#Banner-{{ section.id }} .banner__media::before {
padding-bottom: {{ 1 | divided_by: section.settings.image.aspect_ratio | times: 100 }}%;
content: ‘’;
display: block;
}
}
{%- endstyle -%}
{%- endif -%}

{%- style -%}
#Banner-{{ section.id }}::after {
opacity: {{ section.settings.image_overlay_opacity | divided_by: 100.0 }};
}
{%- endstyle -%}

{%- liquid
assign full_width = ‘100vw’
assign widths = ‘375, 550, 750, 1100, 1500, 1780, 2000, 3000, 3840’

if section.settings.image_behavior == ‘ambient’
assign half_width = ‘60vw’
assign full_width = ‘120vw’
assign stacked_sizes = ‘(min-width: 750px) 60vw, 120vw’
assign widths = ‘450, 660, 900, 1320, 1800, 2136, 2400, 3600, 7680’
elsif section.settings.image_behavior == ‘fixed’ or section.settings.image_behavior == ‘zoom-in’
assign half_width = ‘100vw’
assign stacked_sizes = ‘100vw’
else
assign half_width = ‘50vw’
assign stacked_sizes = ‘(min-width: 750px) 50vw, 100vw’
endif
assign fetch_priority = ‘auto’
if section.index == 1
assign fetch_priority = ‘high’
endif
-%}

{%- if section.settings.image != blank -%}
{%- liquid assign image_height = section.settings.image.width | divided_by: section.settings.image.aspect_ratio if section.settings.image_2 != blank assign image_class = 'banner__media-image-half' endif if section.settings.image_2 != blank and section.settings.stack_images_on_mobile assign sizes = stacked_sizes elsif section.settings.image_2 != blank assign sizes = half_width else assign sizes = full_width endif -%} {{ section.settings.image | image_url: width: 3840 | image_tag: width: section.settings.image.width, height: image_height, class: image_class, sizes: sizes, widths: widths, fetchpriority: fetch_priority }}
{%- elsif section.settings.image_2 == blank -%}
{{ 'hero-apparel-1' | placeholder_svg_tag: 'placeholder-svg' }}
{%- endif -%} {%- if section.settings.image_2 != blank -%}
{%- liquid assign image_height_2 = section.settings.image_2.width | divided_by: section.settings.image_2.aspect_ratio if section.settings.image != blank assign image_class_2 = 'banner__media-image-half' endif if section.settings.image != blank and section.settings.stack_images_on_mobile assign sizes = stacked_sizes elsif section.settings.image_2 != blank assign sizes = half_width else assign sizes = full_width endif -%} {{ section.settings.image_2 | image_url: width: 3840 | image_tag: width: section.settings.image_2.width, height: image_height_2, class: image_class_2, sizes: sizes, widths: widths, fetchpriority: fetch_priority }}
{%- endif -%}
{%- for block in section.blocks -%} {%- case block.type -%} {%- when 'heading' -%}

{{ block.settings.heading }}

{%- when 'text' -%}

{{ block.settings.text }}

{%- when 'buttons' -%}
{%- if block.settings.button_label_1 != blank -%} {{- block.settings.button_label_1 | escape -}} {%- endif -%} {%- if block.settings.button_label_2 != blank -%} {{- block.settings.button_label_2 | escape -}} {%- endif -%}
{%- endcase -%} {%- endfor -%}
{% schema %} { "name": "t:sections.image-banner.name", "tag": "section", "class": "section", "disabled_on": { "groups": ["header", "footer"] }, "settings": [ { "type": "url", "id": "url", "label": "Link for Image Banner" }, { "type": "image_picker", "id": "image", "label": "t:sections.image-banner.settings.image.label" }, { "type": "image_picker", "id": "image_2", "label": "t:sections.image-banner.settings.image_2.label" }, { "type": "range", "id": "image_overlay_opacity", "min": 0, "max": 100, "step": 10, "unit": "%", "label": "t:sections.image-banner.settings.image_overlay_opacity.label", "default": 0 }, { "type": "select", "id": "image_height", "options": [ { "value": "adapt", "label": "t:sections.image-banner.settings.image_height.options__1.label" }, { "value": "small", "label": "t:sections.image-banner.settings.image_height.options__2.label" }, { "value": "medium", "label": "t:sections.image-banner.settings.image_height.options__3.label" }, { "value": "large", "label": "t:sections.image-banner.settings.image_height.options__4.label" } ], "default": "medium", "label": "t:sections.image-banner.settings.image_height.label", "info": "t:sections.image-banner.settings.image_height.info" }, { "type": "select", "id": "desktop_content_position", "options": [ { "value": "top-left", "label": "t:sections.image-banner.settings.desktop_content_position.options__1.label" }, { "value": "top-center", "label": "t:sections.image-banner.settings.desktop_content_position.options__2.label" }, { "value": "top-right", "label": "t:sections.image-banner.settings.desktop_content_position.options__3.label" }, { "value": "middle-left", "label": "t:sections.image-banner.settings.desktop_content_position.options__4.label" }, { "value": "middle-center", "label": "t:sections.image-banner.settings.desktop_content_position.options__5.label" }, { "value": "middle-right", "label": "t:sections.image-banner.settings.desktop_content_position.options__6.label" }, { "value": "bottom-left", "label": "t:sections.image-banner.settings.desktop_content_position.options__7.label" }, { "value": "bottom-center", "label": "t:sections.image-banner.settings.desktop_content_position.options__8.label" }, { "value": "bottom-right", "label": "t:sections.image-banner.settings.desktop_content_position.options__9.label" } ], "default": "middle-center", "label": "t:sections.image-banner.settings.desktop_content_position.label" }, { "type": "checkbox", "id": "show_text_box", "default": true, "label": "t:sections.image-banner.settings.show_text_box.label" }, { "type": "select", "id": "desktop_content_alignment", "options": [ { "value": "left", "label": "t:sections.image-banner.settings.desktop_content_alignment.options__1.label" }, { "value": "center", "label": "t:sections.image-banner.settings.desktop_content_alignment.options__2.label" }, { "value": "right", "label": "t:sections.image-banner.settings.desktop_content_alignment.options__3.label" } ], "default": "center", "label": "t:sections.image-banner.settings.desktop_content_alignment.label" }, { "type": "color_scheme", "id": "color_scheme", "label": "t:sections.all.colors.label", "default": "scheme-1" }, { "type": "header", "content": "t:sections.all.animation.content" }, { "type": "select", "id": "image_behavior", "options": [ { "value": "none", "label": "t:sections.all.animation.image_behavior.options__1.label" }, { "value": "ambient", "label": "t:sections.all.animation.image_behavior.options__2.label" }, { "value": "fixed", "label": "t:sections.all.animation.image_behavior.options__3.label" }, { "value": "zoom-in", "label": "t:sections.all.animation.image_behavior.options__4.label" } ], "default": "none", "label": "t:sections.all.animation.image_behavior.label" }, { "type": "header", "content": "t:sections.image-banner.settings.mobile.content" }, { "type": "select", "id": "mobile_content_alignment", "options": [ { "value": "left", "label": "t:sections.image-banner.settings.mobile_content_alignment.options__1.label" }, { "value": "center", "label": "t:sections.image-banner.settings.mobile_content_alignment.options__2.label" }, { "value": "right", "label": "t:sections.image-banner.settings.mobile_content_alignment.options__3.label" } ], "default": "center", "label": "t:sections.image-banner.settings.mobile_content_alignment.label" }, { "type": "checkbox", "id": "stack_images_on_mobile", "default": true, "label": "t:sections.image-banner.settings.stack_images_on_mobile.label" }, { "type": "checkbox", "id": "show_text_below", "default": true, "label": "t:sections.image-banner.settings.show_text_below.label" } ], "blocks": [ { "type": "heading", "name": "t:sections.image-banner.blocks.heading.name", "limit": 1, "settings": [ { "type": "inline_richtext", "id": "heading", "default": "t:sections.image-banner.blocks.heading.settings.heading.default", "label": "t:sections.image-banner.blocks.heading.settings.heading.label" }, { "type": "select", "id": "heading_size", "options": [ { "value": "h2", "label": "t:sections.all.heading_size.options__1.label" }, { "value": "h1", "label": "t:sections.all.heading_size.options__2.label" }, { "value": "h0", "label": "t:sections.all.heading_size.options__3.label" }, { "value": "hxl", "label": "t:sections.all.heading_size.options__4.label" }, { "value": "hxxl", "label": "t:sections.all.heading_size.options__5.label" } ], "default": "h1", "label": "t:sections.all.heading_size.label" } ] }, { "type": "text", "name": "t:sections.image-banner.blocks.text.name", "limit": 1, "settings": [ { "type": "inline_richtext", "id": "text", "default": "t:sections.image-banner.blocks.text.settings.text.default", "label": "t:sections.image-banner.blocks.text.settings.text.label" }, { "type": "select", "id": "text_style", "options": [ { "value": "body", "label": "t:sections.image-banner.blocks.text.settings.text_style.options__1.label" }, { "value": "subtitle", "label": "t:sections.image-banner.blocks.text.settings.text_style.options__2.label" }, { "value": "caption-with-letter-spacing", "label": "t:sections.image-banner.blocks.text.settings.text_style.options__3.label" } ], "default": "body", "label": "t:sections.image-banner.blocks.text.settings.text_style.label" } ] }, { "type": "buttons", "name": "t:sections.image-banner.blocks.buttons.name", "limit": 1, "settings": [ { "type": "text", "id": "button_label_1", "default": "t:sections.image-banner.blocks.buttons.settings.button_label_1.default", "label": "t:sections.image-banner.blocks.buttons.settings.button_label_1.label", "info": "t:sections.image-banner.blocks.buttons.settings.button_label_1.info" }, { "type": "url", "id": "button_link_1", "label": "t:sections.image-banner.blocks.buttons.settings.button_link_1.label" }, { "type": "checkbox", "id": "button_style_secondary_1", "default": false, "label": "t:sections.image-banner.blocks.buttons.settings.button_style_secondary_1.label" }, { "type": "text", "id": "button_label_2", "default": "t:sections.image-banner.blocks.buttons.settings.button_label_2.default", "label": "t:sections.image-banner.blocks.buttons.settings.button_label_2.label", "info": "t:sections.image-banner.blocks.buttons.settings.button_label_2.info" }, { "type": "url", "id": "button_link_2", "label": "t:sections.image-banner.blocks.buttons.settings.button_link_2.label" }, { "type": "checkbox", "id": "button_style_secondary_2", "default": false, "label": "t:sections.image-banner.blocks.buttons.settings.button_style_secondary_2.label" } ] } ], "presets": [ { "name": "t:sections.image-banner.presets.name", "blocks": [ { "type": "heading" }, { "type": "text" }, { "type": "buttons" } ] } ] } {% endschema %}

This will give you an option to add links to entire section from the customizer like this

And also will take care of pulling down the content to the bottom

1 Like

Hi @Shadab_dev , thank you for much for your advice! It worked!

Glad it worked out for you. Hope this helps in conversions in anyway possible.

Good luck on your business :+1:

1 Like

Hi @Shadab_dev , previously you’d helped me to make my homepageentire image banner clickable. I’m also using an image banner in my About Us page, and that has also become clickable despite no link as been added to the image banner. Could you please help me to disable linkout from the image banner that’s in my About Us page? :folded_hands:t4: :folded_hands:t4: :folded_hands:t4:

Sure @mayami Here you go. I am hoping you haven’t made any changes to the code from that time or have updated your theme to any newer version or so.

Here’s the updated code: https://codepen.io/shaddu-dev-ali/pen/wBwpyKz

Replace all the code with the one provided. Always take a backup first and then try changes. Always recommended so things don’t interfere with other functionalities.

Best
Shadab Ali

1 Like

Hi @Shadab_dev , thank you for replying again!!

  1. I haven’t made any changes to image-banner.liquid file since we last spoke, but I had changes done to theme.liquid file. Would it affect this?

  2. Will the new code remove links from image banners on all pages, except for the homepage where the banner will remain clickable?

Exactly why I always ask and it’s actually very recommended to try the code on a duplicate one first to see other things are not affected, so try this.

And yes, my code gives you a setting to add or choose links to redirect to, just remove the links from the image banner section where you don’t want it to be clickable and it will work just fine.

Best

Shadab

1 Like

Thank you again @Shadab_dev , it worked. Have a nice day :heart_exclamation:

Sounds great :+1:

Hi @Shadab_dev , hope you’re doing well.

I have recently followed a YouTube tutorial to show different image banners on mobile & desktop. (This tutorial: https://www.youtube.com/watch?v=COPugLSWb8g&t=330s)

After I did this, the link for my Mobile image banner is not working. Are you able to help me resolve this?