Skip to content

Instantly share code, notes, and snippets.

@slouma2000
Created November 8, 2014 07:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save slouma2000/9625ba966627cfae41a5 to your computer and use it in GitHub Desktop.
Save slouma2000/9625ba966627cfae41a5 to your computer and use it in GitHub Desktop.
getDeviceOrientation
function getDeviceOrientation() {
// window.innerHeight is not supported by IE
var winH = window.innerHeight ? window.innerHeight : jQuery(window).height();
var winW = window.innerWidth ? window.innerWidth : jQuery(window).width();
//force height for iframe usage
if(!winH || winH == 0){
winH = '100%';
}
// set the height of the document
jQuery('html').css('height', winH);
// scroll to top
window.scrollTo(0,0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment