例:
在执行完一段css3动画后需要隐藏这个元素如何操作?也就是让它不重复动作.
使用animation参数forwards无效.
注:前提是不使用jQuery情况下能做到么?
巴扎黑2017-04-17 11:10:17
To hide this, you can set opacity: 0
We can set the default opacity=0 for an element
Put the animation on each class, and then assign this class to this attribute
@keyframes ani{
0%{opacity: 1}//此处显示转换为1 动画结束后就会自动隐藏了,因为元素的opacity为0,应该使用 display也可以,但我没用过,因为display没有动画效果
}
高洛峰2017-04-17 11:10:17
Is JavaScript acceptable without jQUery?
Depending on different types, two types of events will be triggered during animation playback:
1. AnimationEvent
2. TransitionEvent
The two implementations of the animation end event are:
1. animationend
2. transitionend
The Demo page is here, only Chrome has been tested:
http://codepen.io/longtian/pen/jEyrzN
For big compatibility pitfalls, you can see this part of the source code of AngularUI
https://github.com/angular-ui/bootstrap/blob/7512b93fecb6f27df4f5aeba4c756c0c36aebbf2/src/transition/transition.js#L59
怪我咯2017-04-17 11:10:17
You can use js timer. Just set the timer time to be the same as the css animation time