CSS animation prevents subsequent styling of animated properties
There are two blocks in this JSFiddle : .parent
and .child
.
-
.child
animates using a CSS animation to change its Y position andopacity
- After 3 seconds, a new class is applied to the body. This changes
.child
background-color
andopacity
.
However, in reality only appears background-color
. In other words, animating a property with CSS animation seems to prevent subsequent styling of that property.
How do I change the opacity in a block .child
after animation?
edit: Since @srekoble's workaround is the closest to the answer, I'll mark it as accepted. If anyone else finds out why this is happening, feel free to add an answer.
source to share
The solution would be to use a keyframe again for the opacity property, for example:
@-webkit-keyframes fadein {
from {
opacity: 0;
}
to {
opacity: .5;
}
}
example: http://jsfiddle.net/688zswcv/2/
This is a strange problem.
source to share
You can always use:
.newstate .child{
background-color: rgba(0,0,255,0.5);
}
You set your color to blue and the opacity to 0.5.
Working fiddle here: http://jsfiddle.net/688zswcv/3/
source to share