Skip to content

Instantly share code, notes, and snippets.

@AndyA
Last active October 28, 2015 09:41
Show Gist options
  • Save AndyA/e6b95e7393c5ddb4dfb2 to your computer and use it in GitHub Desktop.
Save AndyA/e6b95e7393c5ddb4dfb2 to your computer and use it in GitHub Desktop.
Show screen resolution
<!DOCTYPE html>
<html>
<head>
<title>How bigz dat ting</title>
<script src="https://code.jquery.com/jquery-2.1.4.min.js"></script>
<script>
$(function() {
function rez() {
var aw = window.screen.availWidth;
var ah = window.screen.availHeight;
var w = window.screen.width;
var h = window.screen.height;
var ww = $(window).width();
var wh = $(window).height();
$("#output").html("width=" + w + "<br>"
+ "height=" + h + "<br>"
+ "availWidth=" + aw + "<br>"
+ "availHeight=" + ah + "<br>"
+ "windowWidth=" + ww + "<br>"
+ "windowHeight=" + wh);
}
rez();
$(window).resize(rez);
});
</script>
<style>
#output {
font-size: 2em;
}
</style>
</head>
<body>
<div id="output"></div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment