How to use fadeIn and fadeOut in jquery

36 views

simple way to use fadeIn fadeOut event in jquery

fadeIn( speed, callback )

speed-denotes speed of fadeIn either as {’slow’,'def’,'fast’} or in milliseconds as {2000}.

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

same components used for.

fadeOut( speed, callback )

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



« Scroll the page using javascript Customise Your Fading Using fadeTo effect in jquery »
Posted on Monday, April 6th, 2009 at 4:02 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?