Created
December 21, 2011 16:23
-
-
Save thunsaker/1506631 to your computer and use it in GitHub Desktop.
Mobile Scroll to top, add extra height if needed
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
// Scroll to top, add extra height to make this possible | |
$(document).ready(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 -= 250; | |
$('body').css('height', nViewH + 'px'); | |
} | |
window.scrollTo(0, 1); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment