I am looking to create a dynamic quotes text slider with two sets of data.
For reference, check out the fiddle link here: https://jsfiddle.net/628r3t1h/
(function() {
var quotes = $(".quotes");
var quoteIndex = -1;
function showNextQuote() {
++quoteIndex;
quotes.eq(quoteIndex % quotes.length)
.fadeIn(1500)
.delay(1000)
.fadeOut(1000, showNextQuote);
}
showNextQuote();
})();
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<!-- set 1 -->
<h1 style="" class="sec1-head">Set 1<br/>
<span style="" class="quotes sec1-head-quotes">Text 1.1</span>
<span style="display: none;" class="quotes sec1-head-quotes">Text 1.2</span>
<span style="display: none;" class="quotes sec1-head-quotes">Text 1.3</span>
</h1>
<!-- set 2 -->
<h1 style="" class="sec1-head">Set 2<br/>
<span style="" class="quotes sec1-head-quotes">Text 2.1</span>
<span style="display: none;" class="quotes sec1-head-quotes">Text 2.2</span>
<span style="display: none;" class="quotes sec1-head-quotes">Text 2.3</span>
</h1>
The goal is to have "Set 1" displayed first followed by "Set 2", and then cycle through them continuously.