【发布时间】:2013-04-24 13:40:40
【问题描述】:
所以我想知道你们对使用 jquery css 或 animate 属性动画对象的效率有何看法。比如……
$('button').click(function(){
$('obj to change').css( 'pos', x );
});
这与 css 过渡属性一起工作
CSS:
transition:all 0.7s ease-in-out;
VS
$('button').click(function(){
$('obj to change').animate({ pos , 'x' });
}, 2000, function() {
// Animation complete.
});
提前感谢大家的输入,或者如果您有更好的建议。
【问题讨论】:
-
CSS3 还不是每个浏览器都支持。
-
您的
animate方法在语法上容易出错。 -
stackoverflow.com/questions/7866423/… 和 stackoverflow.com/questions/2999749/… 。正如现有问题之一中所暗示的那样,预计移动设备会出现更大的差异
-
@Terry Young,IC 感谢您的链接,这很有帮助!
标签: jquery css performance jquery-animate