typed.js使った

$("#typed").typed({
// strings: ["Typed.js is a <strong>jQuery</strong> plugin.", "Try it out!"],
stringsElement: $('#typed-strings'),
typeSpeed: 30,
backDelay: 500,
loop: true,
contentType: 'html', // or text
// defaults to false for infinite loop
loopCount: false,

callback: function(){ console.log( i ) }, //全て終了後
// preStringTyped: function() {foo(); }, //type前
onStringTyped: function() {foo(); }, //type後
resetCallback: function() { foo(); }
});

 

 

innerHTML

$('#fadeInString')[0].innerHTML = text[a];

$('#fadeInString')[0].innerHTML = '';