<html lang="ko">
<head>
<meta charset="UTF-8">
<title>jQuery Element Dimension</title>
<script src="https://code.jquery.com/jquery-1.12.4.min.js"></script>
<script>
$(function() {
$("button").on("click", function() {
var str = "";
str += "브라우저 뷰포트의 크기는 " + $(window).width() + "X" + $(window).height() + "입니다.<br>";
str += "HTML 문서의 크기는 " + $(document).width() + "X" + $(document).height() + "입니다.";
$("#text").html(str);
});
});
</script>
</head>
<body>
<h1>.width()와 .height() 메소드</h1>
<button>브라우저 및 문서의 크기 정보</button>
<p>브라우저의 크기를 조절해가며 위의 버튼을 눌러보세요!</p>
<p id="text"></p>
</body>
</html>