Type once with typeTo()
$('h3').typeTo("Testing Typer.js jQuery Plugin with a 1 time trext string.");
Type indefinitely with typer()
Now let's say you want to loop over a set of strings for the typing effect. Easy!
jQuery Code...
$('[data-typer-targets]').typer();
HTML: Comma seperated version (strings seperated with commas)...
<h2 data-typer-targets="Testing Typer.js jQuery Plugin, Pretty sweet little plugin!"></h2>
HTML: JSON version...
<h2 data-typer-targets='
{ "targets" : ["Testing Typer.js jQuery Plugin.","Pretty sweet little plugin!", "Stumptown has the best coffee in Flatiron."]}'></h2>
That code will start the effect on all elements with the data-typer-targets attribute.
You obviously need to supply it with some source data. The data-typer-targets attribute can be either a comma-separated string or a piece of JSON.
Options
There are some options that are available to you as well:
// Defaults
{
highlightSpeed : 20,
typeSpeed : 100,
clearDelay : 500,
typeDelay : 200,
clearOnHighlight : true,
typerDataAttr : 'data-typer-targets',
typerInterval : 2000
}
Set the options individually:
$.typer.options.highlightSpeed = 500;
About
jquery.typer.js was originally developed for LayerVault by Kelly Sutton.
GitHub code -
https://github.com/jasondavis/jquery.typer.js