Created
September 25, 2013 17:56
-
-
Save Neolot/6703439 to your computer and use it in GitHub Desktop.
Grayscale to color images on hover
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
img.grayscale{ | |
filter: grayscale(100%); | |
-webkit-filter: grayscale(100%); /* For Webkit browsers */ | |
filter: gray; /* For IE 6 - 9 */ | |
-webkit-transition: all .6s ease; /* Fade to color for Chrome and Safari */ | |
filter: url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\'><filter id=\'grayscale\'><feColorMatrix type=\'matrix\' values=\'0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0\'/></filter></svg>#grayscale"); /* Firefox 10+, Firefox on Android */ | |
} | |
img.grayscale:hover{ | |
filter: grayscale(0%); | |
-webkit-filter: grayscale(0%); | |
filter: url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\'><filter id=\'grayscale\'><feColorMatrix type=\'matrix\' values=\'1 0 0 0 0, 0 1 0 0 0, 0 0 1 0 0, 0 0 0 1 0\'/></filter></svg>#grayscale"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment