JSFiddle - React, Tailwind, and code Playground
HTML
<div id="loading">
<p>We are<span class="dots">...</span></p>
</div>
JavaScript
var span = $('.dots');
var text = span.text();
var loading = function()
{
$({
count : 1
}).animate({
count : text.length
}, {
duration : 1000,
step : function() {
span.text( text.substring(0, Math.round(this.count)) );
},
complete : function() {
loading();
}
});
};
loading();