jQuery Fade In Sequence


/ Published in: JavaScript
Save to your folder(s)

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.


Copy this code and paste it in your HTML
  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


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.