JQuery 화면크기 확인

Jmnote bot (토론 | 기여)님의 2020년 11월 2일 (월) 02:53 판 (봇: 자동으로 텍스트 교체 (-</source> +</syntaxhighlight>, -<source +<syntaxhighlight ))
(차이) ← 이전 판 | 최신판 (차이) | 다음 판 → (차이)

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 }}