Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 | 31 |
Tags
- python
- 사망
- 프론트엔드
- Java
- 보험료
- 심장질환
- 보험
- 프로그래밍
- 인출수수료
- 뇌출혈
- 교보
- 교보생명
- 웹개발
- Vue.js
- 추가납입
- 중도인출
- 코딩
- 가입
- 변환
- 급성심근경색증
- 리스트
- 자바스크립트
- 특약
- 문자열
- javascript
- PythonProgramming
- 납입
- jQuery
- 파이썬
- 수수료
Archives
- Today
- Total
SeouliteLab
jQuery의 .outerHeight() 메서드: 요소의 외부 높이 가져오기 본문
jQuery의 .outerHeight() 메서드는 선택한 요소의 외부 높이를 가져옵니다. 이는 요소의 내부 콘텐츠와 패딩(padding), 테두리(border) 및 선택적으로 마진(margin)의 높이를 모두 포함합니다. 이 메서드는 보이는 콘텐츠를 기반으로 하며, 가상의 상자 모델(Virtual Box Model)을 사용하여 계산합니다.
예제 1: 외부 높이 가져오기
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>jQuery .outerHeight() 메서드 예제</title>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script>
$(document).ready(function(){
// 외부 높이 가져오기 예제
var outerHeight = $('.box').outerHeight();
console.log('외부 높이:', outerHeight); // 출력 결과: 외부 높이: 140
});
</script>
<style>
.box {
width: 100px;
height: 100px;
padding: 10px;
border: 5px solid #000;
margin: 10px;
background-color: #f0f0f0;
}
</style>
</head>
<body>
<div class="box"></div>
</body>
</html>
예제 2: 외부 높이 설정하기
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>jQuery .outerHeight() 메서드 예제</title>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script>
$(document).ready(function(){
// 외부 높이 설정하기 예제
$('.box').outerHeight(200);
var newOuterHeight = $('.box').outerHeight();
console.log('변경된 외부 높이:', newOuterHeight); // 출력 결과: 변경된 외부 높이: 200
});
</script>
<style>
.box {
width: 100px;
height: 100px;
padding: 10px;
border: 5px solid #000;
margin: 10px;
background-color: #f0f0f0;
}
</style>
</head>
<body>
<div class="box"></div>
</body>
</html>