JQuery FadeTo

 

In this example, we are going to fade to a certain opacity using fadeTo() function, opacity is set to 0.5.

 
 
 
<!DOCTYPE html> <html> <head> <title>Welcome to LearnKode - A code learning platform</title> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.0/jquery.min.js"></script> <script> $(document).ready(function() { $("p").hover(function() { $("p").fadeTo("2000", 0.5); }); }); </script> </head> <body> <h4>Hover on sample text to see the fadeTo effect</h4> <p>Sample Appwrk Text</p> </body> </html>
Output