JSFiddle - React, Tailwind, and code Playground

by jubair

JavaScript

function flipImages() {
    currentImage = flipArray[i];

    if (i == 6) {
        clearInterval(interval);
    } else {
        // add an opacity animation to the flip so that it is less jarring 
        // set at a 100ms fade in

        $(currentImage).animate({
            opacity: 1
        }, 100, function () {
            console.log(flipArray[i]);
        });

        // also animate in the child divs of the currentImage (which will only be text on 
        // the "final" div) 
        if ($(currentImage).children().hasClass('final')) {
            $(currentImage).children().animate({
                opacity: 1,
                left: '+=50'
            }, 500, function () {
                console.log($(currentImage).children());
            });
        }
        i++;
    }
}