Jump to content

How do I display one .GIF image on desktop and an alternate version formatted for mobile use?

Recommended Posts

Posted

Site URL: https://harvestfilmcompany.com/work

I have a .GIF image displayed at the top of the "Page Content" section, which looks great on desktop, however the image when it is displayed on mobile, it is far too small to view. I know that Squarespace sites are responsive, however, in this case I created a second custom .GIF image to better fit mobile use. What I am attempting to do is display one .GIF only on desktop and a separate .GIF only on mobile. The second .GIF formatted for mobile use is imported into Squarespace's "Custom Files" folder. I have some experience with coding but this exceeds my capabilities. This is the code that I have been working with, trying out different inputs in different places within the main "Custom CSS" window, and the "Advanced Page Settings CSS" window:

  @media only screen and (max-width: 640px) {

image: url(https://static1.squarespace.com/static/5d6037ded262bd00018f22f9/t/5fd90ed9d927c34ff5eb5c7e/1608060634352/Mobile+V1.gif);

}

I am wondering if what I am trying to do is possible, and if not, am I able to make it so the first .GIF is displayed on desktop, and then is hidden on mobile?

  • Replies 4
  • Views 1.1k
  • Created
  • Last Reply
Posted
10 hours ago, harvestfilmco said:

Site URL: https://harvestfilmcompany.com/work

I have a .GIF image displayed at the top of the "Page Content" section, which looks great on desktop, however the image when it is displayed on mobile, it is far too small to view. I know that Squarespace sites are responsive, however, in this case I created a second custom .GIF image to better fit mobile use. What I am attempting to do is display one .GIF only on desktop and a separate .GIF only on mobile. The second .GIF formatted for mobile use is imported into Squarespace's "Custom Files" folder. I have some experience with coding but this exceeds my capabilities. This is the code that I have been working with, trying out different inputs in different places within the main "Custom CSS" window, and the "Advanced Page Settings CSS" window:

  @media only screen and (max-width: 640px) {

image: url(https://static1.squarespace.com/static/5d6037ded262bd00018f22f9/t/5fd90ed9d927c34ff5eb5c7e/1608060634352/Mobile+V1.gif);

}

I am wondering if what I am trying to do is possible, and if not, am I able to make it so the first .GIF is displayed on desktop, and then is hidden on mobile?

Kindly paste this into design->Custom css

@media only screen and (max-width: 768px) {
    #block-yui_3_17_2_1_1607017561137_11291 .sqs-block-image-figure > div {
      padding-bottom: 20% !important;
      overflow: hidden;
      background: url(https://static1.squarespace.com/static/5d6037ded262bd00018f22f9/t/5fd90ed9d927c34ff5eb5c7e/1608060634352/Mobile+V1.gif);
      background-size: cover;
    }
    #block-yui_3_17_2_1_1607017561137_11291 .sqs-block-image-figure > div img {
      opacity: 0 !important;
    }
}

image.png.d866db2c85c86745bbe8493c1b4c735c.png

 

BeyondSpace - Squarespace Website Developer

🖼️ Lightbox Studio (Enable Pinch/Zoom on lightbox - PDF Lightbox popup - ...) </>  🗓️ Delivery Date Picker (Date picker form field)
Gallery block 7.1 workaround </> No-code customisations for Squarespace

Posted
On 12/16/2020 at 5:24 AM, bangank36 said:

Kindly paste this into design->Custom css


@media only screen and (max-width: 768px) {
    #block-yui_3_17_2_1_1607017561137_11291 .sqs-block-image-figure > div {
      padding-bottom: 20% !important;
      overflow: hidden;
      background: url(https://static1.squarespace.com/static/5d6037ded262bd00018f22f9/t/5fd90ed9d927c34ff5eb5c7e/1608060634352/Mobile+V1.gif);
      background-size: cover;
    }
    #block-yui_3_17_2_1_1607017561137_11291 .sqs-block-image-figure > div img {
      opacity: 0 !important;
    }
}

image.png.d866db2c85c86745bbe8493c1b4c735c.png

 

Aw thank you so much! This code worked like a charm. Follow up question, if I want to change the spacing and remove some of the negative space above and below the .gif, what do I add to the code to change that?

Screen Shot 2020-12-18 at 10.58.21 AM.png

Posted
7 hours ago, harvestfilmco said:

Aw thank you so much! This code worked like a charm. Follow up question, if I want to change the spacing and remove some of the negative space above and below the .gif, what do I add to the code to change that?

Screen Shot 2020-12-18 at 10.58.21 AM.png

#block-yui_3_17_2_1_1608062302505_12334 {
  display: none;
}
#block-yui_3_17_2_1_1607017561137_11291 {
  padding-top: 0;
  padding-bottom: 0;
}

 

BeyondSpace - Squarespace Website Developer

🖼️ Lightbox Studio (Enable Pinch/Zoom on lightbox - PDF Lightbox popup - ...) </>  🗓️ Delivery Date Picker (Date picker form field)
Gallery block 7.1 workaround </> No-code customisations for Squarespace

Posted
On 12/18/2020 at 6:51 PM, bangank36 said:

#block-yui_3_17_2_1_1608062302505_12334 {
  display: none;
}
#block-yui_3_17_2_1_1607017561137_11291 {
  padding-top: 0;
  padding-bottom: 0;
}

 

Thank you!

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.