Skip to content

Instantly share code, notes, and snippets.

@henriqueboaventura
Created August 9, 2011 17:50
Show Gist options
  • Save henriqueboaventura/1134702 to your computer and use it in GitHub Desktop.
Save henriqueboaventura/1134702 to your computer and use it in GitHub Desktop.
Type function
function type()
{
var str = text.substr(0, currentChar);
var last = str.substr(str.length -1, str.length);
if(last != '<' && last != '>' & last != '/') {
$("#consoleText").html(str);
}
currentChar++;
if(currentChar <= text.length)
{
if(last == '<') {
htmltag = true;
} else if(last == '>') {
htmltag = false;
}
if(htmltag) {
setTimeout(type, 1);
} else {
setTimeout(type, 50);
}
}
}
$(document).ready(function() {
$("#consoleText").html("");
setTimeout(type, 2000);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment