Any way to smoothly animate window.scrollTo(0, 1)?
It's well-known that iPhone web apps need to call window.scrollTo(0, 1)
if they want to hide the native Mobile Safari toolbar. Unfortunately, this is a very jarring transition; the page slides up ~100px in one go. Is there any way to make this transition smooth?
It doesn't appear that you can use a regular JavaScript animation, because you're only going from 0
to 1
. It also doesn't app开发者_运维技巧ear that you could apply a CSS transition, since you're setting a DOM property (window.scrollY
), not a CSS one.
Perhaps you could hide all of the content on the page until the scrollTo has completed.
精彩评论