我正在尝试为 -webkit-transform
规则设置动画。我试过:
element.children().animate('webkitTransform': "translate3d(200px, 0, 0)", 200);
element.children().animate('WebkitTransform': "translate3d(200px, 0, 0)", 200);
element.children().animate('-webkit-transform': "translate3d(200px, 0, 0)", 200);
我错过了什么?
在没有动画的情况下应用 CSS 效果很好:
element.children().css('-webkit-transform', "translate3d(200px, 0, 0)");
如果我为非前缀属性(如 margin-left
等)设置动画,Animate 也可以工作。
最佳答案
您不能为这个特定属性设置动画,因为它不是数字。前缀与此无关。来自docs :
All animated properties should be animated to a single numeric value, except as noted below; most properties that are non-numeric cannot be animated using basic jQuery functionality
关于jquery - 在 jQuery 中动画前缀 CSS 规则,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23158342/