Jump to content

Resizing image with another mobile friendly image

Recommended Posts

I am working on a site and need to display the desktop version of the image and hide the mobile version, then have it change once it becomes mobile to the new image. I saw a post that said to use this code but I am having a hard time getting it to work. What block id should I be using and is there any other coding I need to add? (am somewhat of a code newbie)

 

@mobile: ~"only screen and (max-width: 640px)";  

@desktop: ~"only screen and (min-width: 900px)";

 

@media @mobile {#block-yui_replacewithblockidofLargeimage {

display: none;}}

 

@media @desktop {#block-yui_replacewithblockidofSmallimage {

display: none;}}

desktop image.png

mobile image.png

Link to comment
52 minutes ago, SaraCreative said:

I am working on a site and need to display the desktop version of the image and hide the mobile version, then have it change once it becomes mobile to the new image. I saw a post that said to use this code but I am having a hard time getting it to work. What block id should I be using and is there any other coding I need to add? (am somewhat of a code newbie)

 

@mobile: ~"only screen and (max-width: 640px)";  

@desktop: ~"only screen and (min-width: 900px)";

 

@media @mobile {#block-yui_replacewithblockidofLargeimage {

display: none;}}

 

@media @desktop {#block-yui_replacewithblockidofSmallimage {

display: none;}}

desktop image.png

mobile image.png

You can try the Squarespace ID Finder extension to find the right ID: https://chrome.google.com/webstore/detail/squarespace-id-finder/igjamfnifnkmecjidfbdipieoaeghcff?hl=en

Here is my demo for find:

- Page ID: http://recordit.co/qwnj09oNCa

- Section ID: https://recordit.co/Aj9vXw6rfY

- Block ID: https://recordit.co/kUIH4uco0b

Hope that it makes sense

BeyondSpace - Squarespace Website Developer

🖼️ Lightbox Studio (Enable Pinch/Zoom on lightbox)
🗓️ Delivery Date Picker (Squarespace Date picker form field)
💫 Gallery block 7.1 workaround
🥳 Sparkplugin Customisations Browsers (Browse +100 Spark plugin customisations)
🥳 Elfsight Template Browsers (Browse +1000 Elfsight widget Templates)

If you find my answer useful, let's leave a like or upvote so others with the same issue can find their solution. Thank you!

 

Link to comment
On 2/22/2022 at 5:18 AM, SaraCreative said:

I am working on a site and need to display the desktop version of the image and hide the mobile version, then have it change once it becomes mobile to the new image. I saw a post that said to use this code but I am having a hard time getting it to work. What block id should I be using and is there any other coding I need to add? (am somewhat of a code newbie)

 

@mobile: ~"only screen and (max-width: 640px)";  

@desktop: ~"only screen and (min-width: 900px)";

 

@media @mobile {#block-yui_replacewithblockidofLargeimage {

display: none;}}

 

@media @desktop {#block-yui_replacewithblockidofSmallimage {

display: none;}}

desktop image.png

mobile image.png

If you share link to your site, we can help easier

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.