Created
May 15, 2012 14:45
-
-
Save Rockncoder/2702315 to your computer and use it in GitHub Desktop.
JQMCalculator Android Address bar hider
This file contains 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
var RocknCoder = RocknCoder || {}; | |
RocknCoder.HideAddressBar = function () { | |
var hideUrlBar = function () { | |
if (!pageYOffset) { | |
window.scrollTo(0, 1); | |
} | |
}; | |
if (navigator.userAgent.match(/Android/i)) { | |
window.scrollTo(0, 0); // reset in case prev not scrolled | |
var docHeight = $(document).height(); | |
var winHeight = window.outerHeight; | |
if (winHeight > docHeight) { | |
winHeight = winHeight / window.devicePixelRatio; | |
$('BODY').css('height', winHeight + 'px'); | |
} | |
window.scrollTo(0, 1); | |
} else { | |
addEventListener("load orientationchange", function () { | |
setTimeout(hideUrlBar, 0); | |
setTimeout(hideUrlBar, 500); | |
}, false); | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment