iOS Safari scroll to top does not work on certain

2019-02-09 08:35发布

问题:

Disclaimer: The site has meanwhile been updated, this issue does not occur anymore with the new version of the design.

On a new site I built I noticed a weird quirk in Safari (iOS 5). Usually you can tap the black bar on top of Safari to scroll to the top of any webpage. On my new website this works on the homepage, but not on single article pages.

Try it! versbeton.nl (works!) vs. versbeton.nl/2012/01/vers-vloeibaar/ (does not work!)

How can I debug such a situation? As far as I know there's no Firebug (or similar debugging tool) for iOS.

回答1:

-webkit-overflow-scrolling:touch is the problem. If you use that anywhere in your CSS, the scroll-to-top shortcut stops working. This is a known problem with iOS 5, there is no workaround unfortunately. Hopefully it will be fixed in iOS 6.



回答2:

You can have something similar to firebug buy using Safari and specifying your web-agent as iPhone. But I'm not sure you will have the same webkit engine.

You can also activate the Developers Tools for Safari in Settings > Safari > Advanced.

Good luck.