My goal is to animate a header whenever the class collapseTest
is applied. After some trial and error, I have come up with the following solution: http://jsfiddle.net/robertrozas/atuyLtL0/1/. A big shoutout to @Hackerman for helping me get it to work.
The desired effect is to make the white div with the class .top
disappear when the class collapseTest
is added to the header. The issue arises because I am using display: table
instead of display: block
, which prevents me from simply hiding the content with the CSS rule display: none
.
I have created an animation that seems to work well with display: block
, but not with table
.
@-webkit-keyframes pushDown {
0% {
height: 50%;
display: table;
}
100% {
height: 0;
display: none;
}
}
I am calling this animation on the div with the class top
:
#header.collapse .top {
-webkit-animation: pushDown 2s forwards linear;
}
Unfortunately, this approach is not producing the desired result. Can anyone pinpoint what I might be doing wrong? Why isn't the div with the class top animating to be hidden?