jQuery fadeToggle() 메서드

❮ jQuery 효과 메서드

예시

다른 상자에 페이드 인과 페이드 아웃 사이를 전환합니다.

$("button").click(function(){
  $("#div1").fadeToggle();
});

정의 및 사용

fadeToggle() 메소드는 fadeIn()fadeOut() 메소드 사이를 토글 합니다.

요소가 페이드 아웃되면 fadeToggle()이 요소를 페이드 인합니다.

요소가 페이드 인되면 fadeToggle()이 요소를 페이드 아웃합니다.

참고 : 숨겨진 요소는 전혀 표시되지 않습니다(더 이상 페이지 레이아웃에 영향을 미치지 않음).


통사론

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

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

Possible values:

  • milliseconds
  • "slow"
  • "fast"
easing Optional. Specifies the speed of the element in different points of the effect. 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 fadeToggle() method is completed

To learn more about callback, please read our jQuery Callback chapter

직접 해보십시오 - 예


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


사용하기 fadeToggle() 메소드가 완료된 후 콜백 매개변수를 사용하여 함수를 실행하는 방법.


❮ jQuery 효과 메서드