Skip to content

Instantly share code, notes, and snippets.

@hirbod
Last active August 29, 2015 14:06
Show Gist options
  • Save hirbod/28ed2ecad25ab1f59fd9 to your computer and use it in GitHub Desktop.
Save hirbod/28ed2ecad25ab1f59fd9 to your computer and use it in GitHub Desktop.
<!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