JSFiddle - React, Tailwind, and code Playground

by neal_fletcher

JavaScript

$(".loader-panel").each(function() {
    var thisPanel = $(this);

    thisPanel.on("oanimationend animationend webkitAnimationEnd", function() {
        if (thisPanel.hasClass("stage-one")) {
            setTimeout(function() {
                thisPanel.removeClass("stage-one").addClass("stage-two");

                thisPanel.css({
                    "z-index": "+=7"
                });
            }, 6000);
        } else if (thisPanel.hasClass("stage-two")) {
            thisPanel.removeClass("stage-two").addClass("stage-three");

            thisPanel.css({
                "z-index": "+=7"
            });
        } else if (thisPanel.hasClass("stage-three")) {
            thisPanel.removeClass("stage-three").addClass("stage-two");

            thisPanel.css({
                "z-index": "+=7"
            });
        }
    });
});