Jump to content

Replace/change image on hover for Project pages in portfolio

Recommended Posts

  • Replies 7
  • Views 1.6k
  • Created
  • Last Reply

Top Posters In This Topic

Add to Home > Design > Custom CSS. Repeat similar for other projects

/* Change image on portfolio item hover */
a.grid-item[href="/work/mlbxfit"]:hover img {
    visibility: hidden;
}
.grid-image-inner-wrapper:after {
    visibility: hidden;
}
a.grid-item[href="/work/mlbxfit"]:hover .grid-image-inner-wrapper {
    background-image: url(https://beaverhero.com/wp-content/uploads/2019/06/trees-3464777_640-min.jpg) !important;
}

 

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
  • 5 months later...

Hey I tried using the CSS provided above and it works but the hover image isn't confined to the width of the wrapper. What am I doing wrong here?

Here's the code I used from above:
/* Change image on portfolio item hover */
a.grid-item[href="/work/anxiocalm"]:hover img {
    visibility: hidden;
}
.grid-image-inner-wrapper:after {
    visibility: hidden;
}
a.grid-item[href="/work/anxiocalm"]:hover .grid-image-inner-wrapper {
    background-image: url(https://static1.squarespace.com/static/607f2d7caeff013b864be14f/t/6081c16961f7c44a415b5cb6/1619116393840/anxio-car-hover.png) !important;
}

Screen Shot 2021-04-22 at 12.54.01 PM.pngScreen Shot 2021-04-22 at 12.54.06 PM.png

Edited by BenWatch
Link to comment
On 4/23/2021 at 1:54 AM, BenWatch said:

Hey I tried using the CSS provided above and it works but the hover image isn't confined to the width of the wrapper. What am I doing wrong here?

Here's the code I used from above:
/* Change image on portfolio item hover */
a.grid-item[href="/work/anxiocalm"]:hover img {
    visibility: hidden;
}
.grid-image-inner-wrapper:after {
    visibility: hidden;
}
a.grid-item[href="/work/anxiocalm"]:hover .grid-image-inner-wrapper {
    background-image: url(https://static1.squarespace.com/static/607f2d7caeff013b864be14f/t/6081c16961f7c44a415b5cb6/1619116393840/anxio-car-hover.png) !important;
}

try this

/* Change image on portfolio item hover */
a.grid-item[href="/work/anxiocalm"]:hover img {
    visibility: hidden;
}
.grid-image-inner-wrapper:after {
    visibility: hidden;
}
a.grid-item[href="/work/anxiocalm"]:hover .grid-image-inner-wrapper {
    background-image: url(https://static1.squarespace.com/static/607f2d7caeff013b864be14f/t/6081c16961f7c44a415b5cb6/1619116393840/anxio-car-hover.png) !important;
background-repeat: no-repeat;
background-size: contain;
}

 

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
  • 10 months later...
  • 2 months later...
On 4/24/2021 at 8:10 AM, tuanphan said:

try this

/* Change image on portfolio item hover */
a.grid-item[href="/work/anxiocalm"]:hover img {
    visibility: hidden;
}
.grid-image-inner-wrapper:after {
    visibility: hidden;
}
a.grid-item[href="/work/anxiocalm"]:hover .grid-image-inner-wrapper {
    background-image: url(https://static1.squarespace.com/static/607f2d7caeff013b864be14f/t/6081c16961f7c44a415b5cb6/1619116393840/anxio-car-hover.png) !important;
background-repeat: no-repeat;
background-size: contain;
}

 

Is there a way to add a transition to this? 

Link to comment
On 5/18/2022 at 10:27 AM, joecookjc said:

Is there a way to add a transition to this? 

Try this code

/* Change image on portfolio item hover */
a.grid-item[href="/work/anxiocalm"]:hover img {
    visibility: hidden;
	transition: all 0.3s;
}
.grid-image-inner-wrapper:after {
    visibility: hidden;
transition: all 0.3s;
}
a.grid-item[href="/work/anxiocalm"]:hover .grid-image-inner-wrapper {
    background-image: url(https://static1.squarespace.com/static/607f2d7caeff013b864be14f/t/6081c16961f7c44a415b5cb6/1619116393840/anxio-car-hover.png) !important;
background-repeat: no-repeat;
background-size: contain;
transition: all 0.3s;
}

 

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.