To use the fade effect in jQuery, you can use the .fadeIn() method. Here’s an example:
$(selector).fadeIn(duration, callback);
Where:
- selector is the element(s) you want to fade in.
- duration is the time in milliseconds it takes for the animation to complete. It is optional and defaults to 400.
- callback is a function that is executed after the fadeIn effect has finished. It is also optional.
Here’s a simple example to fade in a div element with id “myDiv”:
$(document).ready(function(){ $("#myDiv").click(function(){ $(this).fadeIn(3000); }); });