Customise Your Fading Using fadeTo effect in jquery

35 views

fadeTo effect will customize your fading according to your required opacity.

fadeTo( speed, opacity, [callback] )
speed-denotes speed of fadeIn either as {’slow’,'def’,'fast’} or in milliseconds as {2000}.

opacity-starts from 0 to 1.

callback- function that will be executed after each and every animation.

  1. Example:
  2. <style>
  3. div { margin:3px; width:180px; display:none;
  4.         height:80px; float:left; background-color:red;}
  5. span { margin:3px; text-align:left; color:white;}
  6. </style>
  7. <script type="text/javascript">$(document).ready(function(){
  8.    
  9.     $(‘#start’).click(function(){
  10.       $("#div_box").fadeIn("slow",function recall(){
  11.           $(‘#span_content’).fadeTo("slow",1,function (){
  12.           $(‘#span_content’).fadeTo("slow",0.55);
  13.          
  14.  
  15.            recall();
  16.           });
  17.           });
  18.     });
  19. $(‘#stop’).click(function(){
  20.    
  21.     $(‘#span_content’).stop();
  22. });
  23.   });
  24. </script>
  25. <body>
  26. <a id="start" href="javascript:void(0)">Start</a>  <a id="stop" href="javascript:void(0)">Stop</a>
  27. <div id="div_box"><span id="span_content">computereducationworld</span></div>
  28. </body>
  29.  



« How to use fadeIn and fadeOut in jquery ajax with javascript »
Posted on Monday, April 6th, 2009 at 4:31 pm under jQuery | RSS 2.0 Feed

Post Comment

You must be logged in to post a comment.



ComputerEducationWorld.com All Rights Reserved © RSS | CBSE | Education Boards Of India | What is My IP?