jQuery SlideToggle() 메서드

❮ jQuery 효과 메서드

예시

모든 <p> 요소에 대해 slideUp() 및 slideDown() 간에 전환:

$("button").click(function(){
  $("p").slideToggle();
});

정의 및 사용

SlideToggle() 메서드 는 선택한 요소에 대해 slideUp()slideDown() 사이를 토글합니다.

이 메서드는 가시성을 위해 선택한 요소를 확인합니다. 요소가 숨겨져 있으면 SlideDown()이 실행됩니다. 요소가 표시되면 SlideUp()이 실행됩니다. - 이것은 토글 효과를 만듭니다.


통사론

$(selector).slideToggle(speed,easing,callback)

Parameter Description
speed Optional. Specifies the speed of the slide effect. Default value is 400 milliseconds

Possible values:

  • milliseconds
  • "slow"
  • "fast"
easing Optional. Specifies the speed of the element in different points of the animation. Default value is "swing"

Possible values:

  • "swing" - moves slower at the beginning/end, but faster in the middle
  • "linear" - moves in a constant speed
Tip: More easing functions are available in external plugins
callback Optional. A function to be executed after the slideToggle() method is completed

To learn more about callback, visit our jQuery Callback chapter


직접 해보십시오 - 예


사용 속도 매개변수를 사용하여 슬라이드 효과의 속도를 지정하는 방법입니다.


사용 슬라이드업()과 슬라이드다운() 사이를 전환할 때 콜백 매개변수를 사용하는 방법입니다.


❮ jQuery 효과 메서드