I got a website. My Body has a background-image which I want to grayscale after pressing a button. I add the class .grayscale
to the body which contains a .grayscale:before
.
.grayscale {
transition: all 3s;
position: relative;
}
.grayscale:before {
content: "";
z-index: -1;
width: 100%;
height: 100%;
position: fixed;
background-size: cover;
display: block;
background: inherit;
transition: all 3s;
filter: grayscale(70%) brightness(108%);
}
The result is as planned, BUT without the transition. The background is in grayscale which is perfect, but because I add the class the transition doesn't count. How is the proper way to handle these situations?
Thanks in advance!!!