<分区>
标签 javascript html css
<分区>
我有下面的 webkit css 来为我的顶部菜单设置动画。我只想通过 js 控制高度属性(高度:150px),当它的 100% 意味着打开时的最大高度。
from {
height:var(--m,0%);
}
这是我的 CSS
@-webkit-keyframes expand{
0%{height:0px}
100%{height:150px}
}
最佳答案
您可以使用事件animationend
:
https://www.w3schools.com/jsref/event_animationend.asp
document.getElementById('yourselector').addEventListener('animationend', e=>console.log('animation ended'),false)
关于javascript - 当高度为 100% 时操纵 webkit-keyframes 的高度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57009956/