Jump to content

How to disable fallback image on desktop only?

Recommended Posts

Site URL: https://blueberry-bellflower-ls7b.squarespace.com/

PASSWORD - SoRight41!

I am working on a website with a video as background.

This BG Video does not work on mobile, so I have to use a fallback image.

The problem is that on page load, this image is visible for 1 or 2 second. Is possible to hide it completely on Desktop?

ALSO - just wanna check if there is any work around yet for having the video play on mobile?

Thank you 🙂

Edited by mauramanor
Link to comment
  • 5 months later...

I added this code to successfully hide the fallback background image on the homepage for desktop. However it's also hiding the background images on my portfolio pages. How can I only target the homepage?

Here's my site's URL: 

https://magenta-dachshund-daxm.squarespace.com/

Here's the code:

.section-background:first-child img {
    visibility: hidden;
}


@media (max-width: 740px) {
.section-background:first-child img {
    visibility: visible;
}

}

Link to comment
23 hours ago, HuskiiStudio said:

I added this code to successfully hide the fallback background image on the homepage for desktop. However it's also hiding the background images on my portfolio pages. How can I only target the homepage?

Here's my site's URL: 

https://magenta-dachshund-daxm.squarespace.com/

Here's the code:

.section-background:first-child img {
    visibility: hidden;
}


@media (max-width: 740px) {
.section-background:first-child img {
    visibility: visible;
}

}

Use this code

body.homepage .section-background:first-child img {
    visibility: hidden;
}
@media (max-width: 767px) {
body.homepage .section-background:first-child img {
    visibility: visible;
}
}

 

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
  • 7 months later...
20 hours ago, North-Liw said:

Hi, found this code and it works hiding the fallback image flashing. But it also hides another background image on the page.  Is there a way to make it apply to a spesific. block?

Use this code

[data-section-id="id here"] .section-background:first-child img {
    visibility: hidden;
}
@media (max-width: 767px) {
[data-section-id="id here"] .section-background:first-child img {
    visibility: visible;
}
}

use this tool to find data section id https://chrome.google.com/webstore/detail/squarespace-id-finder/igjamfnifnkmecjidfbdipieoaeghcff?hl=en

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

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.