Created
March 5, 2013 09:57
-
-
Save QaDeS/5089192 to your computer and use it in GitHub Desktop.
Reliably hides the address bar on mobile browsers.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
hideAddressBar = -> | |
inScroll = false | |
fun = -> | |
return true if inScroll | |
inScroll = true | |
de = document.documentElement | |
h = window.outerHeight/window.devicePixelRatio | |
if de.scrollHeight < h | |
de.style.height = h + 'px' | |
window.scrollTo 0, 1 | |
inScroll = false | |
return false | |
window.addEventListener "load", fun | |
window.addEventListener "orientationchange", fun | |
window.onscroll = fun | |
setTimeout fun, 100 | |
hideAddressBar() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment