问题
I have an web app developed using jquery mobile. Initially, I was trying to fit content exactly inside viewport by assigning height to the content.
$(".ui-content").height(viewportHeight);
This worked well for me.
But now I want to hide address bar. So for doing this I added some extra pixels to viewportHeight
(e.g. added 1.5px extra to viewportheight
).
As height is now greater than actual device's viewport, scroll down gesture should help hide address bar.
This works on all tablets, but not on android phones in landscape mode. Portrait mode shows expected behavior.
I also tried using window.scrollTo(0,1)
, but this is now deprecated.
I also tried scrolling on other web pages, so it hides address bar in landscape mode too. But its not working with my web app. Can anyone suggest me what could be the problem and how to fix this issue?
Thanks.
来源:https://stackoverflow.com/questions/22378059/hide-address-bar-in-android-chrome-browser-with-scroll-down-gesture