JSFiddle - React, Tailwind, and code Playground

by kougiland

HTML

<h2 class="quotes">first quote</h2>
<h2 class="quotes">second quote</h2>

CSS

.quotes {display: none;}

JavaScript

(function() {

    var quotes = $(".quotes");
    var quoteIndex = -1;
    
    function showNextQuote() {
        ++quoteIndex;
        quotes.eq(quoteIndex % quotes.length)
            .fadeIn(800)
            .delay(600)
            .fadeOut(400, showNextQuote);
    }
    
    showNextQuote();
    
})();