Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Advanced Search
  • 0
Joeyearthly

Different Banner Image on Mobile

Question

Hello! So my site is  https://earthlycraft.co/

It's almost there... but i cant work one thing out. How to change one of my banner hero images for mobile. It looks great on desktop however its too small on mobile,  so i have another logo ready thats zoomed right in that i'd like to use for mobile only. I've added the file in design > custom css > manage custom files so i can use the link to the file

I'm fairly familiar with media queries but i don't know the code to change the banner. When I inspect I get this code:

.sqs-block-image .image-block-outer-wrapper:not(.image-block-v2) .intrinsic .image-block-wrapper img

Therefore i'm going for something along the lines of:

@media only screen and (max-width: 600px) {.sqs-block-image .image-block-outer-wrapper:not(.image-block-v2) .intrinsic .image-block-wrapper img {background image: https://static1.squarespace.com/static/5d00032088447c0001487495/t/5dcdc90c40062f0cf29e9ddc/1573767446853/mobilelogo.png;}}

Help would be much appreciated!!

Cheers!!

 

 

Share this post


Link to post

Recommended Posts

  • 2

ETA: If you are on the newer Squarespace 7.1, this post has a walkthrough: How to Show a Different Banner Image on Mobile in Squarespace

 

Hi @Joeyearthly,

If you are using an index page, I have a different workaround that I like a bit better, since you can make whole area specific for mobile instead of just the banner image. I create two "sub-pages" at the top of the index page, one for desktop view (with the URL slug home-banner) and one for mobile view (with the URL slug home-banner-mobile). Then I add the following code to Custom CSS. (Note that if you want to edit the mobile from your desktop, you'll need to briefly comment out the code so you can see that page on desktop.)

/* show home page block dependent on screen size */ 
@media only screen and (max-width: 780px) { #home-banner { display: none; } } 
@media only screen and (min-width: 781px) { #home-banner-mobile { display: none; } }

 

Edited by christyprice

Share this post


Link to post
  • 0

Hey @christyprice

Thank you so much for this! Great workaround thats done exactly what I wanted it to! That's some outside the box thinking right there...great stuff!

It has presented a bit of a problem though, in that I still don't know how to call the banner image. The container for the image is too darn small and it just cuts off the edges top and bottom of any image I put there....so the bigger zoom image idea isn't working perfectly, yet. If you have any ideas on this code do let me know!

So far, without joy, i've tried 

.sqs-block-html  , .sqs-block-image, .sqs-block-html , .sqs-block-markdown blockquote, .image-block-outer-wrapper:not(.image-block-v2) .intrinsic .image-block-wrapper img

and I just cant get that container to move.

Share this post


Link to post
  • 0
On 11/14/2019 at 4:03 PM, christyprice said:

If you are using an index page, I have a different workaround that I like a bit better, since you can make whole area specific for mobile instead of just the banner image. I create two "sub-pages" at the top of the index page, one for desktop view (with the URL slug home-banner) and one for mobile view (with the URL slug home-banner-mobile). Then I add the following code to Custom CSS. (Note that if you want to edit the mobile from your desktop, you'll need to briefly comment out the code so you can see that page on desktop.)


/* show home page block dependent on screen size */ 
@media only screen and (max-width: 780px) { #home-banner { display: none; } } 
@media only screen and (min-width: 781px) { #home-banner-mobile { display: none; } }

 

@christyprice This sounds like an elegant solution. Do you have any troubleshooting advice? The code doesn't seem to affect my index sections, both remain visible. My site is igcalgary.com but I currently have the mobile only section unlinked, it's not live on my homepage.

Thanks for your help.

Share this post


Link to post
  • 0

@christyprice I love this solution and arrived at something similar for my sites, too. One problem I am running into is essentially the use of Relative Links in the nav menu. So, for example, when users arrive at my site (www.mitchbakker.com) via mobile, they landing page, url slug /home-mobile, is great –but then the primary nav links still point to the url slug /home. So, the user naturally clicks to go "home" at some point, and then they are met with the desktop version of /home. 

Any thoughts on how to provide a solution? 

Share this post


Link to post
  • 0
30 minutes ago, christyprice said:

@justinpheap.co, I use index pages and just hide/show the subpages, so the page URL stays the same. 

Thanks for the quick reply, @christyprice! So, I am currently setup with two separate Index Pages (screenshot). Is this what you recommend with your code –adding it to the overall CSS, then? Thanks again 🙂

Screen Shot 2020-02-06 at 11.11.39 AM.png

Share this post


Link to post
  • 0

@justinpheap.co I use one Home index page. Within that index I have one subpage for desktop view and one subpage for mobile that I show/hide with the code above. 

Share this post


Link to post
  • 0

@christyprice so I implemented your code and created the subpage for mobile view, and it works perfectly EXCEPT for some reason, my Squarespace site is now taking the small mobile images (250 pixels wide) and still stretching them so now I have pixelated images stretched farther than the width of my mobile screen (as opposed to high-resolution, desktop size images stretched farther than my mobile screen, see screenshot attached). Help!

What is wrong? How do I fix this so it stops stretching the images beyond the width of the mobile screen???  I've tried everything I can find online to do, and I just can't seem to get Squarespace to resize images for mobile correctly! 

Test site: https://rhino-dogfish-zyb7.squarespace.com/
Password: Bishop

Thanks 🙏

IMG_2473.PNG

Share this post


Link to post
  • 0

@BRepairers, it's hard to know without seeing your code and images. It might be an issue with the mobile breakpoints. Double check those.

Edited by christyprice

Share this post


Link to post
  • 0
3 minutes ago, christyprice said:

@camilla.ciappina

As with the site above, you’d likely need to have someone log in as an admin to check your code and your images. 

@christyprice if I provide you if access, would you be able to guide me? or I can send the images and screenshot of the code I did for you to review..

thank you so much!

Share this post


Link to post
  • 0
On 11/14/2019 at 11:03 PM, christyprice said:

Hi @Joeyearthly,

If you are using an index page, I have a different workaround that I like a bit better, since you can make whole area specific for mobile instead of just the banner image. I create two "sub-pages" at the top of the index page, one for desktop view (with the URL slug home-banner) and one for mobile view (with the URL slug home-banner-mobile). Then I add the following code to Custom CSS. (Note that if you want to edit the mobile from your desktop, you'll need to briefly comment out the code so you can see that page on desktop.)


/* show home page block dependent on screen size */ 
@media only screen and (max-width: 780px) { #home-banner { display: none; } } 
@media only screen and (min-width: 781px) { #home-banner-mobile { display: none; } }

 

Hi Christy,

Would this work on 7.1?  I have tried the following, but all it does is hide the fallback image and YouTube video in the banner.

//show home page block dependent on screen size
@media only screen and (max-width: 780px) { #page-section-5e73cbba33e8127c09e233ba { display: hide; } } 
@media only screen and (min-width: 781px) { #page-section-5e73cbba33e8127c09e233bc { display: none; } }

I can DM you a link and password if required. Help would be much appreciated. Thank you! 🙂 
Christine 

Share this post


Link to post
  • 0

Hi @equerryconsulting. Unfortunately this solution only works with index pages, so only certain templates in 7.0. I haven’t had to come up with a workaround yet. I’d suggest starting a new thread specific to 7.1 to see if someone can help you out. Best of luck with your website!

Share this post


Link to post
  • 0
On 5/23/2020 at 4:27 AM, Aesthetic_Collab said:

Hello all, I recently implemented the Background Video Plugin from sqspthemes and it works perfectly for a 7.0 Brine site I am designing, however on mobile the video banners won't auto play of course. So I am wondering if I could have a separate mobile index page designed that has video blocks (for users to manually play the videos). Would this concept work for that? Thank you for any advice. 

Try contacting sqspthemes first, their support is good


You can send your question to my email to get faster answer.

How to Setup Password & Share URL  Armadillo - Free portfolio template

Share this post


Link to post
  • 0
Posted (edited)

Share this post


Link to post
  • 0

Hi @christyprice, thanks a lot for sharing. I am facing a problem when using the code and was hoping you might have a quick workaround? The banners display as wanted on web and mobile, but on mobile my banners jump/zoom-in a little bit at a certain point when scrolling down. (caused by the added CSS) 

Thanks a lot in advance.  

Code used: 

@media only screen and (max-width: 780px) { #home-banner { display: none; } } 
@media only screen and (min-width: 781px) { #home-banner-mobile { display: none; } }

Url: www.cotorra-store.com/hompagetest

Share this post


Link to post
  • 0

Hi @eliasbalk, do you have other custom code on your site? I haven't noticed this issue before, so wondering if you have competing code. If you have other code, I'd remove it and see if this works as expected on its own. 

Share this post


Link to post
  • 0

Hi @christyprice, thanks for the quick feedback. There is no other CSS active but problem still remains. When i deactivate Parallax though in SiteStyles the problem disappears. Is that usually the case with this feature to use it only without Parallax? 

Share this post


Link to post
  • 0
Posted (edited)

Ah, gotcha! It does seem to be an issue with parallax. You can turn it off to fix the problem. Here's the general code to turn it off on mobile everywhere. 

@media only screen and (max-width: 780px) { #home-banner { display: none; } figure {
transform: none !important;
top: 0 !important;
bottom: 0 !important;
will-change: auto !important;
} } 
@media only screen and (min-width: 781px) { #home-banner-mobile { display: none; } 
}

To turn off parallax for just that page, you can use the collection-id specific to the page:

@media only screen and (max-width: 780px) { #home { display: none; } #collection-5f1c8fa3acc1cf6f0497d570 figure {
transform: none !important;
top: 0 !important;
bottom: 0 !important;
will-change: auto !important;
} } 
@media only screen and (min-width: 781px) { #home-1 { display: none; } 
}

 

Edited by christyprice

Share this post


Link to post
  • 0

@eliasbalk

Did you get this fixed? I looked at your page, I don't see the zoom issue.


Free Squarespace 7.1 Anchor Link and Accordion Plugins available here!

If I replied to one of your questions with code, it was either CSS or jQuery.

To add CSS, go to Design -> Custom CSS

jQuery needs some additional steps. Head here: https://code.jquery.com/ and click on minified, under jQuery 3.x and copy that code into Squarespace.

After you put that code into the code injection section in Squarespace, you can add the code I supplied. The code from me will need <script> added before it and </script> added after it (only for jQuery).

There are two places that you can add the code, one is site wide (adds to all pages). Settings -> Advanced -> Code Injection

The other is for a specific page (adds to one page only). Pages -> Gear Icon next to the page -> Advanced

Share this post


Link to post
  • 0

Hi @christyprice, thanks a lot for your detailed answer. @rwp It does work now beautifully by excluding the parallax effect from the mobile. But i am still trying to figure out a way to have parallax active on mobile as well.  

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment


×
×
  • Create New...