本文介绍了webkit过渡语法在javascript?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在寻找webkitTransition对象引用
I'm looking for the webkitTransition object reference here
function spawnAnimation(what){
//sets the moving element
var moveingEl = document.getElementById(what);
//gives temp transition property
moveingEl.style.WebkitTransition = "left 2s";
// moveingEl.style.webkitTransition = "top 500ms";
var cLeft = moveingEl.style.left
var cleft = Number(cLeft.slice(0, -2));
var cTop = moveingEl.style.top
var cTop = Number(cTop.slice(0, -2));
moveingEl.style.left = cLeft+200 + "px";
}
这不工作。我想给元素一个过渡属性,然后使它向右移动。当这个代码被调用时,它立即移动到右边,没有动画。
This does not work.I would like to give the element a transition property, then make it move to the right. When this code is called it just immediately moves to the right with no animation. bummer :(. I don't want to predefine it in CSS, I would like to dynamically add it and then remove it.
推荐答案
moveingEl.style.setProperty("-webkit-transition", "left 5s linear");
moveingEl.style.setProperty("left", "200px");
这篇关于webkit过渡语法在javascript?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!