Jump to content

How to make hovered images disappear on mobile

Recommended Posts

Posted

Site URL: http://www.afarnum.com/projects

I've designed a site that has pages with a markdown block. That block has links and images that appear on HOVER. All done through the master css window. The problem is that the image sizes are set and when viewing on mobile, I want them to disappear and to just see the menu. Here is the code that is used for each link:

}

.titles2:hover:before {
    content: '';
    width: 900px;
      left: 30vw;
      top: 50px;
    height: 600px;
      margin-top: 50px;
    display: block;
    position: absolute;
    background: url(https://static1.squarespace.com/static/59171f2ecd0f68c07c2b19b5/t/61f72297b1c3341d379ad0a0/1643586200102/D1-cafe-03279.jpg) center top no-repeat;
    background-size: contain;
    margin: 0 auto 0% !important;
  
}
 

Is there a way to do this? Thanks!!

  • Replies 1
  • Views 388
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted
On 2/15/2022 at 5:11 AM, afarnum said:

Site URL: http://www.afarnum.com/projects

I've designed a site that has pages with a markdown block. That block has links and images that appear on HOVER. All done through the master css window. The problem is that the image sizes are set and when viewing on mobile, I want them to disappear and to just see the menu. Here is the code that is used for each link:

}

.titles2:hover:before {
    content: '';
    width: 900px;
      left: 30vw;
      top: 50px;
    height: 600px;
      margin-top: 50px;
    display: block;
    position: absolute;
    background: url(https://static1.squarespace.com/static/59171f2ecd0f68c07c2b19b5/t/61f72297b1c3341d379ad0a0/1643586200102/D1-cafe-03279.jpg) center top no-repeat;
    background-size: contain;
    margin: 0 auto 0% !important;
  
}
 

Is there a way to do this? Thanks!!

Try adding to Home > Design > Custom Css

@media only screen and (max-width: 767px) {
  #block-yui_3_17_2_1_1643408042301_15100 [data-preserve-html-node]:hover:before {
    content: unset !important;
  } 
}

Let me know how it works on your site

Support me by pressing 👍 if this useful for you

 

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

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.