Jump to content

Custom code for grayscale to colour image on hover in an index

Recommended Posts

Site URL: http://nicolemak.com/

On my portfolio site, I have an index of images. Currently in the Page Styles feature, I am able to add a hover interaction so that the image decreases in opacity and shows text on hover. How do I add custom CSS so that I can make the images on the index appear in grayscale by default, then on hover, appear in colour? 

 

Thanks! Example of grayscale image, then colour image on hover. 

Screen Shot 2021-11-30 at 11.04.27 AM.png

Screen Shot 2021-11-30 at 11.04.22 AM.png

Link to comment
20 hours ago, nicolemak said:

Site URL: http://nicolemak.com/

On my portfolio site, I have an index of images. Currently in the Page Styles feature, I am able to add a hover interaction so that the image decreases in opacity and shows text on hover. How do I add custom CSS so that I can make the images on the index appear in grayscale by default, then on hover, appear in colour? 

 

Thanks! Example of grayscale image, then colour image on hover. 

Screen Shot 2021-11-30 at 11.04.27 AM.png

Screen Shot 2021-11-30 at 11.04.22 AM.png

Have you solved it yet? It seems fine on your site

image.thumb.png.229c861d8e932192cc902c77de980862.png

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

@nicolemak Try adding to Design > Custom CSS

div.index-section img {
    filter: grayscale(1);
    -webkit-filter: grayscale(1);
}
div.index-section:hover img {
    filter: grayscale(0);
    -webkit-filter: grayscale(0);
}

 

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
On 12/7/2021 at 5:18 AM, nicolemak said:

Thank you @tuanphan!! This worked.

Just a small thing, when access your site, the browser says: Not secure. You should install SSL Certificates (SS provide this for free)

https://support.squarespace.com/hc/en-us/articles/205815898-Understanding-SSL-certificates

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.