Is there a better way to scroll a page (with jQuery) in Safari for iPhone (scrollTop doesn't work correctly)

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

Something like that:

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

In normal web browsers, scrolling starts from the current position of the window to the desired position.

On iPhone, the window will move to the top of the document before scrolling to the desired position. This seems to be a deliberate action, but the pages just don't look good with all this movement.

Alternatively, on Google.com for iPhone, when autostart is activated, there is a simple scroll showing the autoload options under the search box. This is what I would like to do ...

+3
source share
1 answer

Have you tried the jQuery ScrollTo plugin?

0
source

Source: https://habr.com/ru/post/1749677/


All Articles