jQuery fadeTo() Method
The fadeTo() method is an inbuilt method in jQuery that is used to change the opacity of the selected element.
$(selector).fadeTo(speed, opacity, easing, call_function)
Here selector is the selected element.
Parameter: It accepts four parameters which are specified below-
- speed: It specifies the speed of the fading effect.
- opacity: It specifies to fade and this value should be between 0.0 and 1.0.
- easing: It specifies the speed at different points of animation.
- call_function: It is an optional parameter and performs a function after performing fadeTo method.
Return Value: It does not return any value.
Example 1: In the below code, no optional function parameter is passed.
Example 2: In the below code, an optional function parameter is passed.