简体   繁体   English

iPad上的jQuery动画(向左滑动)……如何提高性能?

[英]jQuery animate (slide left) on iPad… how can I improve performance?

I am using: 我在用:

$('selector').animate({marginLeft:'-500px'},600);

... to slide a div to the left. ...向左滑动div。 Based on my current HTML/CSS, applying a negative margin works and I want to avoid having to rebuild my HTML/CSS to do it another way. 根据我当前的HTML / CSS,应用负边距是行得通的,并且我想避免不得不重建HTML / CSS来以另一种方式进行操作。 My code works great on all browsers, but it's really choppy on a brand new iPad mini. 我的代码在所有浏览器上都可以正常运行,但是在全新的iPad mini上确实很不可靠。 Is there a better way achieve this effect specific to Safari on iOS? 是否有更好的方法可以实现iOS上特定于Safari的效果?

Try out css transitions instead. 试用CSS转换。 http://www.w3schools.com/css3/css3_transitions.asp http://www.w3schools.com/css3/css3_transitions.asp

Should be possible with minor changes :) 可能需要进行细微的更改:)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM