Typing is hard, let Typer.js do it for you.
Simple function that types out strings and arrays of strings for cool typing effects
npm install typerjs --save
JQuery
<script src="http://code.jquery.com/jquery-1.11.3.min.js"></script>
You'll have to host the library yourself, so:
- Require
var typerjs = require('typerjs');
- Pull in with script (in html)
<script src="your/path/to/typerjs.min.js"></script>
data (string or array)
attribute (attribute by class or id to add to)
type_interval (time between each typed letter)
remove_interval (time between delete/removable of a letter)
highlightColor
textHighlightColor
highlight (boolean [default - false])(option to remove string by highlighting/deleting all or backspacing)
var type = new typerjs({
data: "hello",
attribute: ".message1",
interval: 500
});
var type = new typerjs({
data: ["Santa Claus", "Beer", "Happy Day"],
attribute: ".message2",
type_interval: 200,
remove_interval: 20,
highlightColor: "#444",
textHighlightColor: "#fff",
highlight:true
});
Any issues, report them here.