开发者

How to fix slow scrolling when using webkit-transform and relative positioning on the iphone

开发者 https://www.devze.com 2022-12-23 06:51 出处:网络
I have implemented scrolling of a div by using relative positioning and webkit animation for the iphone, it works beautifully on desktop safari but is choppy on the actual iphone (fine on the simulato

I have implemented scrolling of a div by using relative positioning and webkit animation for the iphone, it works beautifully on desktop safari but is choppy on the actual iphone (fine on the simulator).

The scrolling works by having a div nes开发者_如何学Pythonted and clipped (overflow:hidden) by its parent. I then set the top position and animate it with -webkit style declarations. The iphone seems to noticeably slow down when there are a lot of items in the inner div.

Any ideas how make the scrolling smoother?

This was a problem with iScroll code and my own hand coded stuff.


Using translate3d is much faster than straight up translate, as it utilizes hardware acceleration.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号