Animating elements recursively using a recursive callback with a delay

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

Copy this code and paste it in your HTML
  1. $('a').hide();
  2. (function shownext(jq){
  3. console.log(jq);
  4. jq.eq(0).delay(500).fadeIn("slow").delay(5000).fadeOut("slow", function(){
  5. (jq=jq.slice(1)).length && shownext(jq);
  6. });
  7. })($('a'))


Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.