Different images for mobile than desktop web

Topic summary

A Shopify store owner seeks to display different banner images on mobile versus desktop views.

Initial Solution Provided:

  • Use CSS media queries with .mobile-image and .desktop-image classes
  • Hide/show images based on screen width (992px breakpoint)
  • Add both image pickers to theme schema
  • Insert corresponding HTML with class names in appropriate liquid files

Key Implementation Challenges:

  • Users struggle identifying correct liquid files (theme.liquid, banner.liquid, slideshow.liquid vary by theme)
  • Placement of <style> tags and HTML snippets differs across themes (Debut, Venture, Brooklyn, Minimal, Turbo, Boundless, etc.)
  • Schema modifications work, but HTML integration remains confusing for non-developers

Simplified Solution (Page 6):
A basic static section called “desktop-mobile-banner” with:

  • Two image pickers accessible via Customize editor
  • CSS media queries at 767px breakpoint
  • Optional link field for clickable banners
  • No optimization for different resolutions/screen widths

Ongoing Issues:

  • Page speed concerns (lazy loading suggested via lazysizes library)
  • Padding/spacing adjustments needed
  • Theme-specific implementations require custom code
  • Some users report both images displaying simultaneously
  • Request for slideshow versions with multiple slides

Status: Thread remains active with users requesting theme-specific guidance. The basic section code provides a starting point but requires customization per theme architecture.

Summarized with AI on November 9. AI used: claude-sonnet-4-5-20250929.

Thank you very much for your response - I am understanding the basic concept of this but just figuring out where to place code.

Would that first bit (within the section) be entered into the theme.liquid file? In the theme I am using, the images that I’m trying to apply this too are called ‘banners’ and there is also two ‘banner-liquid’ files (one within Sections, and one within Snippets), so I’m unsure if it should go within one of those.

I have a feeling I need to add in the Sections banner-liquid file, is this right? The code for this currently is:

<div class="velaBanner" style="{% if section.settings.margin_block !=blank %}margin:{{section.settings.margin_block}}; {% endif %}
{% if section.settings.padding_block !=blank %}padding:{{section.settings.padding_block}}; {% endif %}">
<div class="container{% if section.settings.full_with %}-full{% endif %}">
<div class="{{ section.settings.effect }}">
{% if section.settings.link != blank %}<a href="{{ section.settings.link }}" title="{{ block.settings.image.alt | default: shop.name }}">{% endif %}
{% if section.settings.image != blank %}
<img class="img-responsive" alt="{{ section.settings.image.alt | default: shop.name }}" src="{{ section.settings.image | img_url: '2000x' }}" />
{% else %}
<img class="img-responsive" alt="{{ shop.name }}" src="//placehold.it/{{ section.settings.image_size }}" />
{% endif %}
{% if section.settings.link != blank %}</a>{% endif %}
</div>
</div>
</div>
{% schema %}
{
"name": "Vela Banner",
"class": "velaFramework",
"settings": [
{
"type": "header",
"content": "Design Block"
},
{
"type": "checkbox",
"id": "full_with",
"label": "Enabel Full Width?"
},
{
"type": "text",
"id": "margin_block",
"label": "Margin",
"placeholder": "0px 0px"
},
{
"type": "text",
"id": "padding_block",
"label": "Padding",
"placeholder": "0px 0px"
},
{
"type": "header",
"content": "General Settings"
},
{
"type": "text",
"id": "image_size",
"label": "Image Size",
"info": "Image Size is required."
},
{
"type": "text",
"id": "link",
"label": "Image Link"
},
{
"type": "image_picker",
"id": "image",
"label": "Banner Image"
},
{
"type": "select",
"id": "effect",
"label": "Effect",
"default": "effectOne",
"options": [
{
"value": "effectOne",
"label": "Effect one"
},
{
"value": "effectTwo",
"label": "Effect two"
}
]
}
],
"presets": [
{
"name": "Vela Banner",
"category": "4. Vela Image"
}
]
}
{% endschema %}

And then the other bit you mentioned (starting with

) - should that be entered in the locations where I want the specific images to be placed? If so, I’m struggling to find the ‘homepage’ within the ‘Edit Code’ section in my code where the ‘banners’ are currently… is it normally in the ‘templates’, ‘sections’ .?

Appreciate any further help!