Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Force address bar to show in mobile Chrome app

Tags:

I'm working on a web app. Most of the app has scrolling disabled, however one fullscreen panel needs to be scrollable.

The problem:

If the user is in the part of the app that's scrollable, and scrolls down, the address bar disappears. If, after the address bar disappears, the user decides to exit that panel by clicking an X on the fixed-position menu bar, then the address bar never gets triggered (because scrolling up never happens) and so the user is stuck in a scroll-disabled address-bar-less state.

My question:

Is it possible to force trigger the address bar to show in Google Chrome?

Links!

JSBin output

JSBin code

btw

Simply setting $(window).scrollTop(0) doesn't do it.

Emulating using dev tools doesn't work. You need to open it in a mobile device, in the chrome app.

Thanks!


Example below:

No scrolling allowed, address bar showing

img1)

Scrolling allowed, address bar showing

img2

User scrolled, address bar hiding

img3

Go back to scrolling-disabled div, address bar is hidden

img4

like image 767
a... Avatar asked Aug 14 '14 00:08

a...


1 Answers

One workaround is to use a div as a scrollable container for body content. This way the body is not scrollable, but the inner div and Chrome doesn't autohide the address bar when this inner div is scrolled:

<body style="margin:0;padding:0;width:100%;height:100%">
  <div style="position:absolute;width:100%;height:100%;overflow:scroll">
    Content
  </div>
</body>

Scroll bar visible: http://jsbin.com/zibewepiwo

Scroll bar auto hide: http://jsbin.com/yeyapijulo

Tested in Chrome Beta 44.0.2403.63 and Chrome 43.0.2357.93 in Android 4.4.2 (Samsung Galaxy Tab 3).

like image 103
Timo Kähkönen Avatar answered Oct 14 '22 19:10

Timo Kähkönen