Javascript examples for jQuery Method and Property:fadeIn
The fadeIn() method changes the opacity from hidden to visible.
$(selector).fadeIn(speed,easing,callback);
Parameter | Require | Description | Value |
---|---|---|---|
speed | Optional. | speed of the fading effect. | Default value is 400 milliseconds. Possible values: milliseconds "slow" "fast" |
easing | Optional. | speed of the element in different points of the animation. | Default value is "swing" |
callback | Optional. | A function to be executed after the fadeIn() method is completed | a function |
Possible easing values:
The following code shows how to Fade in all <p> elements:
<!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <script> $(document).ready(function(){ $(".btn1").click(function(){ $("p").fadeOut() });/*from www . j a v a 2 s. co m*/ $(".btn2").click(function(){ $("p").fadeIn(); }); }); </script> </head> <body> <p>This is a paragraph.</p> <button class="btn1">Fade out</button> <button class="btn2">Fade in</button> </body> </html>