jQuery 효과 fadeTo() 메서드
예시
모든 <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:
|
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:
|
callback | Optional. A function to be executed after the fadeTo() method is completed
To learn more about callback, visit our jQuery Callback chapter |
직접 해보십시오 - 예
사용 요소를 페이드 인 및 페이드 아웃할 때 콜백 매개변수를 사용하는 방법입니다.