-
-
Save danro/1322906 to your computer and use it in GitHub Desktop.
Hide Browser Address Bar - Android + iPhone
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
function configAddressBar (addHeight) { | |
var defaultHeight = 50; | |
if (typeof addHeight == "undefined") addHeight = 1; | |
function hideAddressBar() { | |
if(!window.location.hash) | |
{ | |
if(document.height < window.outerHeight) | |
{ | |
document.body.style.height = (window.outerHeight + defaultHeight + addHeight) + 'px'; | |
} | |
window.scrollTo(0, addHeight); | |
} | |
} | |
window.addEventListener("load", function(){ if(!window.pageYOffset){ hideAddressBar(); } } ); | |
window.addEventListener("orientationchange", hideAddressBar ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment