I've been encountering a problem with my website. I have implemented grayscale filters on four different images using CSS by creating an .svg file. Now, I'm looking to disable the grayscale filter and show the original colors whenever a user clicks on an image. The challenge is that CSS only has :active and :hover options, but I want this effect during click action. Below is the code I've used:
//CSS
<style type="text/css">
#main, #beverage, #set, #appetizer {
filter: url(filters.svg#grayscale); /* Firefox 3.5+ */
filter: gray; /* IE6-9 */
-webkit-filter: grayscale(1); /* Google Chrome & Safari 6+ */
}
#main {
filter: none;
-webkit-filter: grayscale(0);
}
//IMAGES
<td>
<img src="main.png" width="80" style="cursor:pointer" id="main"><br>
<img src="beverage.png" width="80" style="cursor:pointer" id="beverage"><br>
<img src="set.png" width="80" style="cursor:pointer" id="set"><br>
<img src="set.png" width="80" style="cursor:pointer" id="appetizer"><br>
</td>