Skip to content

Instantly share code, notes, and snippets.

@weisjohn
Created June 20, 2012 20:40
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 weisjohn/2962071 to your computer and use it in GitHub Desktop.
Save weisjohn/2962071 to your computer and use it in GitHub Desktop.
Page for displaying device orientation
<!doctype html>
<html lang="en-us">
<head>
<meta charset="utf-8">
<title>Orientation Test</title>
<style>
body { text-align: center; }
@media all and (orientation:portrait) {
body { font-size: 35em; margin-top: .3em; }
}
@media all and (orientation:landscape) {
body { font-size: 20em; margin-top: 0em; }
}
</style>
</head>
<body>
<div id="orientation-value"></div>
<script type='text/javascript' src='jquery-1.7.1.min.js'></script>
<script>
var checkOrientation = function() {
$('#orientation-value').html(window.orientation);
};
$(window).on('load', checkOrientation).on('orientationchange', checkOrientation);
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment