0

I'm using fadeToggle to fade a couple of images in and out on a loop. Is there a way to start the fading in of image 2 after image 1 is done fading out and so on?

This is the code I'm working with;

$(function() {
    function run_animation($element, delay, duration) {
        $element.delay(delay).fadeToggle(duration, function () {
            run_animation($element, delay, duration);
        });
    }
    run_animation($('.pointer1'), 1000, 1200);
    run_animation($('.pointer2'), 3000, 1200);
    run_animation($('.pointer3'), 4500, 1200);
    run_animation($('.pointer4'), 6000, 1200);
    run_animation($('.pointer6'), 7500, 1200);
    run_animation($('.pointer7'), 9000, 1200);
    run_animation($('.pointer8'), 10500, 1200);
});
dfsq
  • 191,768
  • 25
  • 236
  • 258
JamesM
  • 101
  • 2
  • 3
  • 11

0 Answers0