Skip to content

Instantly share code, notes, and snippets.

@franciscojsc
Created March 21, 2018 15:28
Show Gist options
  • Save franciscojsc/6b11b33f06ab4ff6f134ff9e8eb5cb11 to your computer and use it in GitHub Desktop.
Save franciscojsc/6b11b33f06ab4ff6f134ff9e8eb5cb11 to your computer and use it in GitHub Desktop.
Máquina de escrever [Efeito de maquina de escrever em JavaScript] // source https://jsbin.com/cilihoy
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="[Efeito de maquina de escrever em JavaScript]">
<meta charset="utf-8">
<title>Máquina de escrever</title>
<script type="text/javascript">
window.onload = function(){
var txtTitulo = 'Francisco Chaves. Tecnologia com bits codificados.';
var txt1 = document.getElementById("titulo");
var speed = 100;
var cont = 0;
function typeWriter () {
if(cont < txtTitulo.length){
txt1.innerHTML += "<u>" + txtTitulo.charAt(cont) + "</u>";
cont++;
setTimeout(typeWriter, speed);
}else{
cont = 0;
}
}
typeWriter();
};
</script>
</head>
<body>
<h1 id="titulo"></h1>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment