Skip to content

Instantly share code, notes, and snippets.

@JulesNeck
Created October 2, 2011 13:37
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save JulesNeck/1257461 to your computer and use it in GitHub Desktop.
Save JulesNeck/1257461 to your computer and use it in GitHub Desktop.
Hide URL Bar for iOS and Android based on html5 mobile boilerplate
// Hide URL Bar for iOS and Android "level above next level"
// streamlined version without extension part
// slowly moving it to perfection...
MBP.hideUrlBar = function () {
if ( !location.hash ) {
doScrollTop = setInterval(function(){
if( document.body && !( ( pageYOffset || document.body.scrollTop ) > 20 ) ){
clearInterval( doScrollTop );
scrollTo( 0,1 );
pageYOffset = 0;
scrollTo( 0, ( pageYOffset === document.body.scrollTop ) ? 1 : 0 );
}
}, 200 );
}
};
@joshuakim
Copy link

Hey Jens,

For when the page is too short, instead of adding another div element, how about adjusting doc.body's height to be innerHeight's + 60 or so px?
You think this is good too, or you see any issues settings height to body?

Thanks,
~ JK ~

@JulesNeck
Copy link
Author

JulesNeck commented Oct 4, 2011 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment