.height()
설명 : 일치하는 요소 집합의 첫 번째 요소에 대한 현재 계산 된 높이를 가져옵니다.
간의 차이 .css( "height" )와 .height()후자 (예를 들어, 단위가없는 화소 값을 반환하는 것이다 400)하면서 전자 리턴 (예를 들면, 완전한 단위의 값 400px). 이 .height()방법은 요소의 높이를 수학 계산에 사용해야 할 때 권장됩니다.
// Returns height of browser viewport
$( window ).height();
// Returns height of HTML document
$( document ).height();
참고 .height()항상 CSS의 값에 관계없이 내용의 높이를 반환합니다 box-sizing속성입니다. jQuery 1.8부터는 CSS 높이 + box-sizing속성을 검색 한 다음 요소가있을 때 각 요소에서 잠재적 인 경계 및 패딩을 빼야 할 수 있습니다 box-sizing: border-box. 이 페널티를 피하려면, .css( "height" )보다는 페널티를 사용하십시오 .height().
예:
다양한 높이를 보여주십시오. 값은 iframe에서 가져온 값이므로 예상 한 것보다 작을 수 있습니다. 노란색 강조 표시는 iframe 본문을 표시합니다.
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>height demo</title>
<style>
div {
width: 50px;
height: 70px;
float: left;
margin: 5px;
background: rgb(255,140,0);
cursor: pointer;
}
</style>
<script src="https://code.jquery.com/jquery-1.10.2.js"></script>
</head>
<body>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<script>
$( "div" ).one( "click", function() {
$( this ).height( 30 ).css({
cursor: "auto",
backgroundColor: "green"
});
});
</script>
</body>
</html>
게시글 목록
| 번호 | 제목 |
|---|---|
| 15969 |
jQuery
.jquery
|
| 15968 |
JavaScript
공휴일을 제외한 시간적용 ON/OFF 스크립트예제 (휴일추가가능)
|
| 15967 |
jQuery
.is()
|
| 15966 |
jQuery
.insertBefore()
|
| 15965 |
jQuery
.insertAfter()
|
| 15964 |
jQuery
.innerWidth ()
|
| 15963 |
jQuery
.innerHeight ()
|
| 15962 |
jQuery
.index()
|
| 15961 |
jQuery
jQuery( ":image" )
|
| 15960 |
jQuery
jQuery ( "# id")
|
| 15959 |
jQuery
.html()
|
| 15958 | |
| 15957 |
jQuery
.hide ()
|
| 15956 |
jQuery
jQuery ( ": hidden")
|
| 15955 |
기타
그누보드5 기본쿼리
|
| 15954 |
jQuery
.height()
현재글
|
| 15953 |
jQuery
jQuery ( ": header")
|
| 15952 |
jQuery
.hasClass( className )
|
| 15949 |
PHP
네이버 클로버 tts
3
|
| 15947 |
node.js
네이트온 팀룸으로 메일 수신 확인
1
|
| 15946 |
jQuery
jQuery ( ": has (selector)")
|
| 15945 |
jQuery
attributeHas 선택자
|
| 15944 |
jQuery
.has (selector)
|
| 15942 |
jQuery
.get (index)
|
| 15941 |
jQuery
.focusin (handler)
|
| 15940 |
jQuery
.focusin (handler)
|
| 15939 |
jQuery
jQuery ( ": focus")
|
| 15938 |
jQuery
.focus (handler)
|
| 15937 |
jQuery
jQuery( ":first" )
|
| 15936 |
jQuery
jQuery ( ": first-of-type")
|
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기