Write A Simple Click Opacity Fade - Javascript jQuery Method and Property

Javascript examples for jQuery Method and Property:fadeTo

Description

Write A Simple Click Opacity Fade

Demo Code

ResultView the demo in separate window


<html>
   <head> 
      <script src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script> 
   </head> 
   <body> 
      <div id="soilink">
         soilink/*from   w  ww .  j av a 2 s.  c o m*/
      </div> 
      <h1 id="soi">SOI</h1> 
      <script>
var fades=[0,1], f=0;
$('#soilink').click(function() {
   $('#soi').stop().fadeTo(300, fades[f++%2]);
});

      </script>  
   </body>
</html>

Related Tutorials