We Recommend

Pro JavaScript Techniques Pro JavaScript Techniques
Pro JavaScript Techniques is the ultimate JavaScript book for the modern web developer. It provides everything you need to know about modern JavaScript, and shows what JavaScript can do for your web sites. This book doesn't waste any time looking at things you already know, like basic syntax and structures.


Posted By

1man on 03/10/08


Tagged

opacity navigation jquery fade animation


Versions (?)


jQuery Fade In Sequence


Published in: JavaScript 


I'm sure i can clean this up quite a bit, but it works for the moment.

This function looks to see if you are on a selected page. If you are it hides the navigation, then loops through and shows each li one after the other. So they don't all fade in together. Needs a tidy i think.


  1. if($j('body').is('#mtvGuy')){
  2. //Hide before the fade
  3. $j('div#sideNav li').hide();
  4. /**
  5. * Side Navigation fade in loop
  6. */
  7. function outer(){
  8. var a = 0;
  9. function inner(){
  10. if(a===$j('div#sideNav li').length){return;}
  11. a++;
  12. $j('div#sideNav ul li').eq(a).fadeIn(210,function(){fader();});
  13. }
  14. return inner;
  15. }
  16. var fader = outer();
  17. fader();
  18. }

Report this snippet 

You need to login to post a comment.