Jump to content

How to create hover effect to replace blog cover images in gallery?

Recommended Posts

Posted
3 hours ago, websitedesigner said:

Hi,

Is it possible to create a hover effect for each blog cover image in a Squarespace gallery, where the image is replaced with a different image on hover? If so, how can I do this with custom CSS?

For more context: I want the secondary image to be a special effect version of the original image.

Thanks!

https://cat-wrasse-ynly.squarespace.com/
pw: jacob

You can try the following to make cover images disappear and show the alternative one

.blog-image-wrapper .image-wrapper img {
  opacity: 1;
  transition: opacity 1s ease-in-out;
}
.blog-image-wrapper .image-wrapper:hover img {
  opacity: 0;
}
.blog-image-wrapper .image-wrapper:after {
  content: '';
  display: block;
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
}
/*Add you url link for alternative image, each below codes quote equals to a blog item*/

.blog-image-wrapper .image-wrapper[href*="through-the-grapevine-june"]:after {
  background-image: url(https://plus.unsplash.com/premium_photo-1671499727370-0dfad502c619?w=500&auto=format&fit=crop&q=60&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90b3MtZmVlZHwxfHx8ZW58MHx8fHx8);
}

 

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 7/1/2024 at 10:34 PM, Beyondspace said:

You can try the following to make cover images disappear and show the alternative one

.blog-image-wrapper .image-wrapper img {
  opacity: 1;
  transition: opacity 1s ease-in-out;
}
.blog-image-wrapper .image-wrapper:hover img {
  opacity: 0;
}
.blog-image-wrapper .image-wrapper:after {
  content: '';
  display: block;
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
}
/*Add you url link for alternative image, each below codes quote equals to a blog item*/

.blog-image-wrapper .image-wrapper[href*="through-the-grapevine-june"]:after {
  background-image: url(https://plus.unsplash.com/premium_photo-1671499727370-0dfad502c619?w=500&auto=format&fit=crop&q=60&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90b3MtZmVlZHwxfHx8ZW58MHx8fHx8);
}

 

Thank you! I think it'll be quite a hassle when there are 100 over blog posts.

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.