通过 JavaScript 使用更改animation-duration
(或在本例中为)属性后,我在 Chrome 中的元素检查器中看到了更改,但实际动画速度没有改变。另外,如果我手动更改元素检查器中的值,也没有任何变化。-webkit-animation-duration
setProperty("-webkit-animation-duration", value + "s")
我设置了一个输入字段来获取动画速度值,该值连接到以下事件侦听器(orbitFactor
是在其他地方定义的全局变量):
function updateSpeed(event) {
var planetDiv = document.getElementById(event.target.id);
planetDiv.style.setProperty("width", event.target.value / orbitFactor);
planetDiv.style.setProperty("height", event.target.value / orbitFactor);
planetDiv.style.setProperty("-webkit-animation-duration", event.target.value + "s");
}
事件侦听器肯定会被调用,并且-webkit-animation-duration
元素检查器中的值确实会发生变化,但动画的速度不会。关于我这里有什么遗漏-webkit-animation-duration
吗?我使用相同方法更改的其他属性(例如width
和)确实发生了明显变化。height
提前致谢
编辑:请注意,这是 Chrome 40 中的一个问题,但它在 Chrome 42 和 Firefox 35 中正常工作。