你好,你的问题有点模棱两可。
如果使用转换而不是动画,则可以在同一个CSS示例中控制其流:
transition: background-color .2s linear 0s; /*Standard*/
如果您想用JS中断转换,那么当您想要的某个操作被触发时,您可以将其他CSS valor分配给不同的类名或属性。
.normal{
transition: background-color .2s linear 0s; /*Standard*/
}
[stop = yes] {
background: black;
}
document.body.addEventListener('mouseover', function(e){
e.stopPropagation();
if(someting you want){
document.queryselector(".normal").setAttribute("stop","yes");
}
else{
document.queryselector(".normal").setAttribute("stop","no");
}
},false);
如果你想要的东西被触发了,那么atribute将被设置为no。
过渡,这也切断了一个运行。