Created
June 12, 2012 20:57
-
-
Save psiborg/2920092 to your computer and use it in GitHub Desktop.
Page for displaying device orientation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!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