I want to add a display:none property to a keyframe-animations' end. Like so:
.sw_intro{
animation: introtop;
animation-duration: 0.8s;
animation-delay: 2s;
animation-fill-mode: forwards;
}
@keyframes introtop {
0% {margin-top: 0;display: block;}
100%{display: none;margin-top: 100vh;}
}
But the display:none-property doesn't get used. I assume that is not an error of my "code" but something that is not allowed/doable. Though I'd like to have that effect at the end of the animation and it must be something like display:none effect, not opacity:0;
How could I do/achieve that? With jquery instead?
Thanks!
With jQuery :
Your initial CSS :
Your jQuery :
display
is not a property that will work with animation. Instead you could change the dimensions (eitherheight
orwidth
) to0
and setoverflow:hidden;
to the element. In that way, the element should be effectively missing from the page.