Latest web development tutorials

jQuery를 치수

jQuery를함으로써 손쉽게 처리하기 위해 상기 브라우저 창 요소의 크기.


jQuery를 치수 방법

jQuery를 치수의 복수의 처리를위한 중요한 방법을 제공한다 :

  • 폭 ()
  • 높이 ()
  • innerWidth ()
  • innerHeight ()
  • outerWidth ()
  • outerHeight ()

jQuery를 치수

jQuery를 치수


jQuery를 폭 ()과 높이 () 메소드

폭 () 메소드 세트 또는 (패딩, 테두리 또는 여백 제외) 요소의 폭을 돌려줍니다.

높이 () 메소드 세트 또는 (패딩, 테두리 또는 여백 제외) 요소의 높이를 돌려줍니다.

다음 예제에서는 지정된 <div> 요소의 폭과 높이를 반환합니다 :

$("button").click(function(){
var txt="";
txt+="Width: " + $("#div1").width() + "</br>";
txt+="Height: " + $("#div1").height();
$("#div1").html(txt);
});

»시도


jQuery를 innerWidth () 및 innerHeight () 메소드

innerWidth () 메서드는 (패딩 포함) 요소의 폭을 돌려줍니다.

innerHeight () 메서드는 (패딩 포함) 요소의 높이를 돌려줍니다.

내부 폭은 다음 예제에서는 지정된 <div> 요소 / 높이를 반환합니다 :

$("button").click(function(){
var txt="";
txt+="Inner width: " + $("#div1").innerWidth() + "</br>";
txt+="Inner height: " + $("#div1").innerHeight();
$("#div1").html(txt);
});

»시도


jQuery를 outerWidth ()와 outerHeight () 메소드

outerWidth () 메서드는 (패딩 및 테두리 포함) 요소의 폭을 돌려줍니다.

outerHeight () 메서드는 (패딩 및 테두리 포함) 요소의 높이를 돌려줍니다.

다음 예제에서는 지정된 <div> 요소 외부 너비 / 높이를 반환합니다 :

$("button").click(function(){
var txt="";
txt+="Outer width: " + $("#div1").outerWidth() + "</br>";
txt+="Outer height: " + $("#div1").outerHeight();
$("#div1").html(txt);
});

시험