Revision: 45528
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at May 3, 2011 07:08 by diogoweb
Initial Code
<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery-git.js"></script>
<script>
$(window).resize(function() {
$("#test").text($(document).width() + " x " + $(document).height());
});
</script>
</head>
<body>
<button id="getp">Get Paragraph Height</button>
<button id="getd">Get Document Height</button>
<button id="getw">Get Window Height</button>
<div> </div>
<p>
Resize window
</p>
<script>
function showHeight(ele, h) {
$("div").text("The height for the " + ele +
" is " + h + "px.");
}
$("#getp").click(function () {
showHeight("paragraph", $("p").height());
});
$("#getd").click(function () {
showHeight("document", $(document).height());
});
$("#getw").click(function () {
showHeight("window", $(window).height());
});
</script>
<div id="test"></div>
</body>
</html>
Initial URL
Initial Description
Initial Title
Get browser viewport
Initial Tags
Initial Language
jQuery