Created
March 13, 2014 15:06
-
-
Save sbrandwoo/9530184 to your computer and use it in GitHub Desktop.
Browse sizes
This file contains hidden or 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
body { | |
height: 2000px; | |
} | |
.container { | |
margin: 0 auto; | |
width: 960px; | |
} | |
.jWinInnerWidth, | |
.jWinInnerHeight, | |
.clientWidth, | |
.clientHeight { | |
font-weight: bold; | |
} | |
.box { | |
background: red; | |
opacity: 0.25; | |
position: absolute; | |
top: 0; | |
left: 0; | |
width: 1003px; | |
height: 50px; | |
} |
This file contains hidden or 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> | |
<head> | |
<meta name="description" content="[add your bin description]" /> | |
<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script> | |
<meta charset="utf-8"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<div class="container"> | |
<div class="ratio">Ratio: <span></span></div> | |
<div class="innerWidth">innerWidth: <span></span></div> | |
<div class="innerHeight">innerHeight: <span></span></div> | |
<div class="clientWidth">clientWidth: <span></span></div> | |
<div class="clientHeight">clientHeight: <span></span></div> | |
<div class="jDocWidth">jDocWidth: <span></span></div> | |
<div class="jDocHeight">jDocHeight: <span></span></div> | |
<div class="jDocInnerWidth">jDocInnerWidth: <span></span></div> | |
<div class="jDocInnerHeight">jDocInnerHeight: <span></span></div> | |
<div class="jWinInnerWidth">jWinInnerWidth: <span></span></div> | |
<div class="jWinInnerHeight">jWinInnerHeight: <span></span></div> | |
<div class="userAgent">userAgent: <span></span></div> | |
<div class="box"></div> | |
</div> | |
</body> | |
</html> |
This file contains hidden or 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
function run() { | |
$('.ratio span').text(window.devicePixelRatio || 1); | |
if (window && window.innerHeight) { | |
$('.innerHeight span').text(window.innerHeight); | |
} | |
if (document && document.documentElement && document.documentElement.clientHeight) { | |
$('.clientHeight span').text(document.documentElement.clientHeight); | |
} | |
if (window && window.innerWidth) { | |
$('.innerWidth span').text(window.innerWidth); | |
} | |
if (document && document.documentElement && document.documentElement.clientWidth) { | |
$('.clientWidth span').text(document.documentElement.clientWidth); | |
} | |
$('.jDocWidth span').text($(document).width()); | |
$('.jDocHeight span').text($(document).height()); | |
$('.jDocInnerWidth span').text($(document).innerWidth()); | |
$('.jDocInnerHeight span').text($(document).innerHeight()); | |
$('.jWinInnerWidth span').text($(window).innerWidth()); | |
$('.jWinInnerHeight span').text($(window).innerHeight()); | |
$('.userAgent span').text(navigator.userAgent); | |
} | |
run(); | |
setInterval(run, 1000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment