3
I have a writing effect code, but it only works when updating the page, I wanted it to run automatically, someone can give a strength?
Below is the code. what I need to change or add to make it infinite, without having to update the page?
function typeWriter(elemento) {
const textoArray = elemento.innerHTML.split('');
elemento.innerHTML = '';
textoArray.forEach((letra, i) => {
setTimeout(() => elemento.innerHTML += letra, 75 * i);
});
}
const titulo = document.querySelector('h1');
typeWriter(titulo);
Note: the writing is coming from a h1
I put into HTML.
thanks a lot. it worked! , just out of curiosity, as I do to put that bar ?
– Guilherme Alonso
I added it in the reply. See if it solves.
– Sam