Jump to content

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

Recommended Posts

Posted

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

Posted
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 - PDF Lightbox popup - ...) </>  🗓️ Delivery Date Picker (Date picker form field)
Gallery block 7.1 workaround </> No-code customisations for Squarespace

Posted
2 hours ago, bangank36 said:

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

image.thumb.png.229c861d8e932192cc902c77de980862.png

Hi BaNgan,  @bagank36 

No I haven't yet! The images are displayed in colour by default, I would like to have them displayed in grayscale by default, then show colour on hover. 

Posted
On 12/3/2021 at 11:58 PM, tuanphan said:

@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);
}

 

Thank you @tuanphan!! This worked.

Posted
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!)

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.