Created
May 17, 2012 07:30
-
-
Save Rockncoder/2717189 to your computer and use it in GitHub Desktop.
JQMSkeleton hide address bar File
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
| var RocknCoder = RocknCoder || {}; | |
| RocknCoder.hideAddressBar = function() { | |
| if (navigator.userAgent.match(/Android/i)) { | |
| window.scrollTo(0, 0); // reset in case prev not scrolled | |
| var nPageH = $(document).height(); | |
| var nViewH = window.outerHeight; | |
| if (nViewH > nPageH) { | |
| nViewH = nViewH / window.devicePixelRatio; | |
| $('BODY').css('height', nViewH + 'px'); | |
| } | |
| window.scrollTo(0, 1); | |
| addEventListener("resize", function () { | |
| setTimeout(hideUrlBar, 0); | |
| setTimeout(hideUrlBar, 500); | |
| }, false); | |
| function hideUrlBar() { | |
| if (!pageYOffset) { | |
| window.scrollTo(0, 1); | |
| } | |
| } | |
| } | |
| return this; | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment