Jump to content

How to change video to image in mobile view

Recommended Posts

  • Replies 5
  • Views 831
  • Created
  • Last Reply

Top Posters In This Topic

Hi! I think the best way to do it is basically to create two sections / blocks. The first will be a block video that will be hidden in phone view with a @media only screen and (min-width: ---px). The second will be a block image with a @media only screen and (max-width: ---px) that will be hidden in desktop views. All you have to do is to target the elements on the browser and include it on the media queries.

I hope this helps you.

Link to comment

Hi Alpi87, 

Thanks for taking time to reply 🙂 I've just tried making a new block underneath the video with an image to replace the video and with this code:

 

@media screen and (min-width: 640px) {
  #block-yui_3_17_2_1_1604939840025_6352 {
display: none;
  }
}

@media screen and (max-width: 640px) {
  #block-yui_3_17_2_1_1605258275843_406161 {
display: none;
  }
}

It doesn't work unfortunately. The video disappear but instead of showing the mobile image, there is an empty block. I guess it is because its a fullscreen background video and not a video-block?

Hope it makes sense..

 

Link to comment
  • 11 months later...
On 11/9/2021 at 1:54 AM, Jaime Santa Cruz said:

Hi Tuanphan,

I need help. Can you send me the code to  hide 1 block on mobile, hide 1 block on desktop. Please. It would be really useful. 

Thank in advance,

 

use this CSS

/* hide block 1 on desktop */
@media screen and (min-width:768px) {
#block-1-id {display:none;}
}
/* hide block 2 on mobile */
@media screen and (max-width:767px) {
#block-2-id {display:none;}
}

Use this code to find block 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.