I'm working on a display page for my website.
The main text in the center needs to change every 60 seconds.
I have over 150 individual lines of text that I want to cycle through on the page.
What would be the most efficient way to load all these text lines?
Should I load them one by one or from another file?
I just want to find the best way to handle loading the text smoothly.
var divs = $('div[id^="content-"]').hide(),
i = 0;
(function cycle() {
divs.eq(i).fadeIn(2000)
.delay(60000) // 1000 is 1 second
.fadeOut(2000, cycle);
i = ++i % divs.length;
})();
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div id="content-1">text 1</div>
<div id="content-2">text 2</div>
<div id="content-3">text 3</div>
<div id="content-4">text 4</div>
<div id="content-5">text 5</div>
<div id="content-6">text 6</div>
<div id="content-7">text 7</div>
......
<div id="content-180">text 180</div>