JSFiddle - React, Tailwind, and code Playground
HTML
<p>Following is an item that will keep updating; hover over it to pause on the current value:</p>
<p id="updatePara"></p>
CSS
p {
padding: 10px;
}
#updatePara {
color: darkblue;
}
JavaScript
var list = ["Hi there, this is an item.",
"Another item goes here somewhere.",
"Whatever, I don't have much imagination.",
"The quick brown fox jumps over the lazy dog."];
var pause = false,
i = 0;
setInterval(function() {
if (pause)
return;
$("#updatePara").text(list[i++ % list.length]);
}, 500);
$("#updatePara").hover(
function() {
pause = true;
},
function() {
pause = false;
}
);