반응형
jquery를 사용하여 화면의 '높이'를 얻는 방법
이 질문에 이미 답변이 있습니다.
화면 중앙에 뭔가 설정하고 싶어요
감사합니다
$(window).height(); // returns height of browser viewport
$(document).height(); // returns height of HTML document
여기에 설명 된대로 : http://api.jquery.com/height/
반응 형 웹 사이트와 함께 사용 (모바일 또는 iPad에서보기)
jQuery(window).height(); // return height of browser viewport
jQuery(window).width(); // return width of browser viewport
거의 사용하지 않음
jQuery(document).height(); // return height of HTML document
jQuery(document).width(); // return width of HTML document
$(window).height();
중간에 무엇이든 설정 비용 CSS를 사용할 수 있습니다.
<style>
#divCentre
{
position: absolute;
left: 50%;
top: 50%;
width: 300px;
height: 400px;
margin-left: -150px;
margin-top: -200px;
}
</style>
<div id="divCentre">I am at the centre</div>
참고 URL : https://stackoverflow.com/questions/2407221/how-to-get-the-height-of-the-screen-using-jquery
반응형
'ProgramingTip' 카테고리의 다른 글
C # 사전 하나의 키 많은 값 (0) | 2020.11.26 |
---|---|
BOOL을 삽입하는 Objective-C 사전 (0) | 2020.11.26 |
Objective C에서 NSNumber 비교 (0) | 2020.11.26 |
BinaryReader의 모든 바이트를 소비하는 우아한 방법? (0) | 2020.11.26 |
Vim- 이전 위치로 이동 (0) | 2020.11.26 |