Skip to content Skip to sidebar Skip to footer

Fading Images - Where To Call .fadein And .fadeout?

Been hitting my head a while with this one. I'm a total novice in JavaScript and jQuery. After a lot of trial and error I eventually managed to write a function to change the src

Solution 1:

It should be done like this (using the callbacks) -

functionnextSlide() {
    slideshow.fadeOut(function() {
        $(this).attr('src',images[current = ++current % images.length]).fadeIn();
    });

    setTimeout(nextSlide, 5000);
}

This insures that the source is not changed until the fade out is complete. The source changes and the fade in then happens. This will not be a cross-fade though.

Post a Comment for "Fading Images - Where To Call .fadein And .fadeout?"