Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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

joshuakim commented Oct 4, 2011

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

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