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

Posted by Keeron on Stack Overflow See other posts from Stack Overflow or by Keeron
Published on 2010-06-11T21:37:26Z Indexed on 2010/06/11 21:42 UTC
Read the original article Hit count: 187

Filed under:
|
|
|
|

Hi there, 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 below the search box. That's what I'd like to do...

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about iphone