Skip to content

Instantly share code, notes, and snippets.

@stvedt
Created September 18, 2012 15:30
Show Gist options
  • Save stvedt/3743770 to your computer and use it in GitHub Desktop.
Save stvedt/3743770 to your computer and use it in GitHub Desktop.
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Accurate Viewport with jQuery</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js"></script>
<script>
$(document).ready(function(){
var viewPort = $(window);
viewPort.resize(function(){
console.log('height: ' + viewPort.height());
console.log('width: ' + viewPort.width());
});
});
</script>
</head>
<body>
<p>Lorem ipsum delorem amet.</p>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment