Skip to content

Instantly share code, notes, and snippets.

@darelf
Created March 8, 2017 15:56
Show Gist options
  • Save darelf/6ab2f2fd88d8416add4138b1dc08c25c to your computer and use it in GitHub Desktop.
Save darelf/6ab2f2fd88d8416add4138b1dc08c25c to your computer and use it in GitHub Desktop.
Minimal Javascript "typing" effect
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