JSFiddle - React, Tailwind, and code Playground
by mohammadAdil
HTML
<h1>I like: <span class="hobbies">array items go here</span></h1>
JavaScript
var hobbies=new Array("graphic design.","photography.", "videography.", "marketing.", "craft beers.");
var count = 0;
setInterval(function() {
scrollText(hobbies[count]);
count++;
if (count == hobbies.length ) {
count = 0;
}
}, 3000);
function scrollText(text) {
$(".hobbies").animate({opacity:0},function(){
$(this).html(text)
.animate({opacity:1});
})
}