Skip to content

Instantly share code, notes, and snippets.

@psiborg
Created June 12, 2012 20:57
Show Gist options
  • Save psiborg/2920092 to your computer and use it in GitHub Desktop.
Save psiborg/2920092 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