Created
March 8, 2017 15:56
-
-
Save darelf/6ab2f2fd88d8416add4138b1dc08c25c to your computer and use it in GitHub Desktop.
Minimal Javascript "typing" effect
This file contains hidden or 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
function type_line(tlen, text, target, timing) { | |
var txt = text.substr(0, tlen++) | |
target.innerHTML = txt | |
if (tlen < text.length + 1) { | |
setTimeout(type_line.bind(null, tlen, text, target), timing) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment