"JQuery 화면크기 확인"의 두 판 사이의 차이

잔글 (봇: 자동으로 텍스트 교체 (-</source> +</syntaxhighlight>, -<source +<syntaxhighlight ))
 
(다른 사용자 한 명의 중간 판 3개는 보이지 않습니다)
1번째 줄: 1번째 줄:
==개요==
==개요==
;jQuery 화면크기 확인
;jQuery 화면크기 확인
* 너비: $(windows).width()
;jQuery 화면크기 구하기
* 높이: $(windows).height()
* 너비: $(window).width()
* 높이: $(window).height()


==예시==
==예시==
<source lang='html'>
<syntaxhighlight lang='html'>
<button id="update-btn">화면크기 얻기</button>
<button id="update-btn">화면크기 얻기</button>
<input type="text" id="size" />
<input type="text" id="size" />
15번째 줄: 16번째 줄:
});
});
</script>
</script>
</source>
</syntaxhighlight>
<jsfiddle>nm2g5dkj</jsfiddle>
<jsfiddle>nm2g5dkj</jsfiddle>
:→ 단, 여기서는 Result 창의 내부크기임...
:→ 단, 여기서는 Result 창의 내부크기임...
23번째 줄: 24번째 줄:
* [[window 객체]]
* [[window 객체]]


[[분류: JavaScript]]
[[분류: jQuery]]

2020년 11월 2일 (월) 02:53 기준 최신판

1 개요[ | ]

jQuery 화면크기 확인
jQuery 화면크기 구하기
  • 너비: $(window).width()
  • 높이: $(window).height()

2 예시[ | ]

<button id="update-btn">화면크기 얻기</button>
<input type="text" id="size" />

<script src="//code.jquery.com/jquery.min.js"></script>
<script>
$("#update-btn").click(function() {
  $('#size').val( $(window).width() + " × " + $(window).height() );
});
</script>
→ 단, 여기서는 Result 창의 내부크기임...

3 같이 보기[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}