Chapter 08. 위치/크기 관련 기능 다루기. Lesson 02. 문서의 위치 및 크기 관련 기능
WEB/JQUERY-CONCEPT 2017. 11. 14. 12:52 |Chapter 08. 위치/크기 관련 기능 다루기.
Lesson 02. 문서의 위치 및 크기 관련 기능
01. 소개
02. 핵심 내용
핵심 01. 문서 크기 구하기
사용법 :
$(document).width()
$(document).height()
예제 01. 다음 실행화면처럼 현재 문서의 크기를 #info 영역에 출력해 주세요
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | <script> $(document).ready(function() { // 윈도우 크기가 변경되는 경우 발생하는 이벤트인 resize 이벤트 리스너를 showInfo() 함수 호출 $(window).on("resize",function() { // 정보 출력 showInfo(); }) // 시작 시 화면에 문서 크기가 출력될 수 있게 showInfo() 함수를 호출해 줍니다. showInfo(); }) // 현재 showInfo() 함수를 이용해서 document 크기 정보 출력 function showInfo() { var strInfo = ""; strInfo += '$("document").width() = '+$(document).width()+"<br>"; strInfo += '$("document").height() = '+$(document).height()+"<br>"; $("#info").html(strInfo); } </script> |
'WEB > JQUERY-CONCEPT' 카테고리의 다른 글
Chapter 08. 위치/크기 관련 기능 다루기. Lesson 04. 윈도우의 위치 및 크기 관련 기능 (0) | 2017.11.14 |
---|---|
Chapter 08. 위치/크기 관련 기능 다루기. Lesson 03. 화면의 위치 및 크기 관련 기능 (0) | 2017.11.14 |
Chapter 08. 위치/크기 관련 기능 다루기. Lesson 01. 요소의 위치 및 크기 관련 기능 (0) | 2017.11.13 |
Chapter 07. 이벤트 다루기. Lesson 02. 핵심 내용 (0) | 2017.11.12 |
Chapter 06. 속성 다루기. Lesson 01. 속성 소개. Lesson 02. 핵심 내용 (0) | 2017.11.10 |