Skip to content

Instantly share code, notes, and snippets.

@nola
Last active September 17, 2015 20:37
Show Gist options
  • Save nola/21d4b9216dbc98498f07 to your computer and use it in GitHub Desktop.
Save nola/21d4b9216dbc98498f07 to your computer and use it in GitHub Desktop.
window.addEventListener('orientationchange', doOnOrientationChange);
function doOnOrientationChange(){
if (window.orientation == -90 || window.orientation == 90) {
//alert('landscape');
} else if (window.orientation == 0) {
//alert('portrait');
}
}
doOnOrientationChange();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment