Skip to content

Instantly share code, notes, and snippets.

@thedaviddias
Created November 12, 2012 10:45
Show Gist options
  • Save thedaviddias/4058605 to your computer and use it in GitHub Desktop.
Save thedaviddias/4058605 to your computer and use it in GitHub Desktop.
MOBILE: Orientation class + browser bar hide
// Add class orientation and push browser bar out
function setOrientation() {
var orient = Math.abs(window.orientation) === 90 ? 'landscape' : 'portrait';
$('body').attr('class', orient);
//pushing safari status bar out of view
if (!location.hash) {
setTimeout(function () {
if (!pageYOffset) window.scrollTo(0, 1);
}, 1000);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment