Created
March 21, 2018 15:28
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!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