Jump to content

Mobile Background Image Change on 7.0

Recommended Posts

Posted

Hi all,

I've set a background image for one page (https://www.regardingdew.com/pivoting-toward-wholeness)

And it's doesn't work on mobile. I'd love to have an alternative image if possible. Here is the code that I tried in the CSS section, and no luck (nothing updates)

@media screen and (max-width:767px) {
/* hide current image */
[data-section-id="5e8c390a09dbf467b60fb0c3"] .section-background img {
    visibility: hidden;
}
/* set new image */
[data-section-id="5e8c390a09dbf467b60fb0c3"] .section-background {
    background-image: url(https://images.squarespace-cdn.com/content/v1/55118900e4b05b9bd93e8e97/cfbeb81f-5c7e-424c-8235-7b1af80771c1/mobile+2.png?format=2500w);
    background-size: cover;
    background-repeat: no-repeat;
    background-position: center center;
}
}

 

I might have the data-section-ids wrong, those were from the code that I grabbed. Anyone know what I can try? Thank you in advance!

  • Replies 1
  • Views 876
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Posted

@Regarding Hi! Your code won't work on a Squarespace 7.0 site. You can add this code under Custom CSS to display the background image on mobile:

@media screen and (max-width:767px) {
body#collection-667598e386789159fb020b87 {
    background-image: url(https://images.squarespace-cdn.com/content/v1/55118900e4b05b9bd93e8e97/cfbeb81f-5c7e-424c-8235-7b1af80771c1/mobile+2.png?format=2500w) !important;
    background-size: cover;
    background-repeat: no-repeat;
    background-position: center center;
    background-attachment: fixed;
}
}

 

If my comments were useful, please like or mark my solution as answer so others can scroll to it quickly. 

Sam
Web Developer & Digital Designer

 Did you find my contribution helpful? Buy me a coffee?

Create an account or sign in to comment

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


×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.