Quantcast
Channel: Infomation Technology » jquery
Viewing all articles
Browse latest Browse all 10

.innerHeight() .innerWidth()

$
0
0
.innerHeight()
픽셀의 위쪽과 아래쪽 패딩을 포함한 요소의 높이를 반환한다.
윈도우와 문서 개체에 적용되지 않는다. 윈도우와 문서 개체에 대해 사용할 땐 .height()를 사용한다.

사용예
<!DOCTYPE html>
<html>
<head>
  <style>p { margin:10px;padding:5px;border:2px solid #666; }</style>
  <script src="http://code.jquery.com/jquery-1.4.4.js"></script>
</head>
<body>
  <p>Hello</p><p></p>
<script>var p = $("p:first");
$("p:last").text( "innerHeight:" + p.innerHeight() );</script>

</body>
</html>

 

.innerWidth()
픽셀의 왼쪽과 오른쪽 패딩을 포함한 요소의 높이를 반환한다.
윈도우와 문서 개체에 적용되지 않는다. 윈도우와 문서 개체에 대해 사용할 땐 .width()를 사용한다.
사용예
<!DOCTYPE html>
<html>
<head>
  <style>p { margin:10px;padding:5px;border:2px solid #666; } </style>
  <script src="http://code.jquery.com/jquery-1.4.4.js"></script>
</head>
<body>
  <p>Hello</p><p></p>
<script>var p = $("p:first");
$("p:last").text( "innerWidth:" + p.innerWidth() );</script>

</body>
</html>

Viewing all articles
Browse latest Browse all 10