Jump to content

Different background image on mobile - I tried one code already but the new image shows only for a moment

Recommended Posts

Site URL: https://www.nelakubickova.com/

So I tried this code:


@media screen and (max-width:767px) {
[data-section-id="5fa2232697ec03254a90eb09"] .section-background img {
    visibility: hidden !important;
}
[data-section-id="5fa2232697ec03254a90eb09"] .section-background {
    background-image: url(https://static1.squarespace.com/static/5f29fbcbcc1280320f186bfe/t/5fb53a78a960184392c4446a/1605712517183/wanted+02.png) !important;
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
}
}

The data-section-id seemes to work (even though I was worried to find it) but when I load the page, the image  appears just for a moment and then the old image shows and stays when its fully loaded.

I have no idea what to do now, I feel like I'm almost there but I'm not haha. Please help!
@tuanphan

Link to comment
  • Replies 1
  • Views 490
  • Created
  • Last Reply
@media screen and (max-width:767px) {
[data-section-id="5fa2232697ec03254a90eb09"] .section-background-canvas {
    visibility: hidden;
}
[data-section-id="5fa2232697ec03254a90eb09"] .section-background {
    background-image: url(https://static1.squarespace.com/static/5f29fbcbcc1280320f186bfe/t/5fb53a78a960184392c4446a/1605712517183/wanted+02.png) !important;
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
}
}

Use new code, here I changed .section-background img tag to .section-background-canvas

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

Link to comment

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.