In my product, I am displaying a loading message as the user waiting for the action to finish. To keep them waiting, we are displaying did you know facts to keep them occupied while they wait.
Initially, I had set up the messages to work with jQuery but need to convert this functionality into CSS only.
<span class="quotes">Message 1</span>
<span class="quotes">Message 2</span>
<span class="quotes">Message 3</span>
<span class="quotes">Message 4</span>
<span class="quotes">Message 5</span>
<span class="quotes">Message 6</span>
<span class="quotes">Message 7</span>
...
<span class="quotes">Message 12</span>
<script>
(function() {
var quotes = $(".quotes");
var quoteIndex = -1;
function showNextQuote() {
++quoteIndex;
quotes.eq(quoteIndex % quotes.length)
.fadeIn(2000)
.delay(5000)
.fadeOut(2000, showNextQuote);
}
showNextQuote();
})();</script>
This code allows the messages to appear one by one and have a fadeIn and fadeOut animation before each one.
question from:
https://stackoverflow.com/questions/65849610/display-divs-one-by-one-with-css-animation 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…