开发者

Is there a better method for scrolling a page (with jQuery) in Safari for iPhone (scrollTop doesn't work right)

I am working on an iPhone version of a website, and I am using jQuery .animate() with the scrollTop attribute to scroll to different sections of the page.

Something like so:

$('html,body').animate({ scrollTop: distance }, 300);

On regular web browsers, the scrolling starts from the current window position to the desired position.

On the iPhone, the window jumps back to the top of the document before scrolling to the desired position. This is apparently the intended action, but the pages just don't look good with all that movement.

Alternatively, on Google.com for the iPhone, when the autosuggest is activated, there is a nice simple scroll to show the autosuggest options bel开发者_Python百科ow the search box. That's what I'd like to do...


Have you tried the jQuery ScrollTo plugin?

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜