Different Size Image Banner for Desktop-Mobile versions not working properly

Hello guys,

I was able to use some code on my website from another community question, where the idea was to have two different images on my website, depending on the device the end-user is using - mobile or desktop through the image-banner section.

It works fine, the only issue is that when selecting a smaller image for the desktop and a bigger image for mobile as well selecting the option “Adapt section height to first image size” the image on the mobile cuts off. This happens as the first image (desktop image) is smaller and Shopify uses the size of the first image to decide what height to apply when the “Adapt section…” option is set to true.

Could you help me with some code so that when on desktop, the option “Adapt section…” reads the height of the image for the desktop and consequently, when on mobile, it reads the height for the mobile image?

The code I have added to the section-mage-banner.css file so far:

/*Added from Shopify Community*/

.banner__media:first-child {
    width: 100%;
}
.banner__media+.banner__media {
    display: none;
}

@media screen and (max-width: 749px) {
	.banner__media:first-child {
		display: none;
	}
	.banner__media+.banner__media {
		width: 100%;
		display: block !important;
	}

}

The same user that suggested the code above, suggested to add the following code to fix the issue I am describing, but it does not work on my instance.

@media screen and (max-width: 749px) {
	.banner__content::before{
		padding-bottom: 150% !important;
	}
}

Thank you in advance!

1 Like

@BYMRLIMA

yes, please share store url

The store URL is pullcase.co.uk

It is unprotected.

This is PageFly - Free Landing Page Builder.

I suggest you don’t use the height of image like that, because css code doesn’t have any logic that can read the native height and adapt with it. You should use an image that fit with your design

Currently i checked on your page, the banner image has been hidden. You can remove the code for the banner to show up again

Hope this can help you solve the issue

Best regards,

PageFly

Hello,

Please check the following link for your reference.

https://share.icloud.com/photos/0fbmakFaTXuyTNETLrDgmjOrw

I am trying to get that image on the bottom of the website, however, if I manage to put it right on the mobile versions, it get’s too big on the desktop screens. If I get it right on the desktop screens, it get’s cut on the mobile version.

The idea is to have a bigger version on the mobile version and a smaller/more discreet version on the desktop.

Could you help me find out what would be the best approach here?

Thanks in advance,

Tiago

I see, with this, can you share the URL where that banner screen is?

Hello,

Yes, sure. Here you go - https://pullcase.co.uk/pages/womens-clothing-the-home-of-premium-printing

1 Like

@BYMRLIMA

oh sorry but i can’t see

Sorry for the late response, i can’t see the issue now, but its better to use the background video - responsive like this.

If you need any more help don’t hesitate to contact us