jQuery 효과 fadeTo() 메서드

❮ jQuery 효과 메서드

예시

모든 <p> 요소의 불투명도를 점진적으로 변경합니다.

$("button").click(function(){
  $("p").fadeTo(1000, 0.4);
});

정의 및 사용

fadeTo() 메서드는 선택한 요소의 불투명도를 지정된 불투명도로 점진적으로 변경합니다(페이딩 효과).


통사론

$(selector).fadeTo(speed,opacity,easing,callback)

Parameter Description
speed Required. Specifies the speed of the fading effect.

Possible values:

  • milliseconds
  • "slow"
  • "fast"
opacity Required. Specifies the opacity to fade to. Must be a number between 0.00 and 1.00
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 fadeTo() method is completed

To learn more about callback, visit our jQuery Callback chapter


직접 해보십시오 - 예


사용 요소를 페이드 인 및 페이드 아웃할 때 콜백 매개변수를 사용하는 방법입니다.


❮ jQuery 효과 메서드