Skip to content
Matt Boldt edited this page Mar 23, 2014 · 6 revisions

Welcome to the typed.js wiki! Here you'll find some cool different use cases for Typed.js.

Initiate Typed on click

http://jsfiddle.net/mattboldt/tcRUG/

$(function(){
    var options = {
        strings: ["First sentence.", "Second sentence."],
        typeSpeed: 0
    }
    $("button").click(function(){
        $(".element").typed(options);
    });
});

Use <input placeholder=""/>

http://jsfiddle.net/mattboldt/M3YaZ/

Here the main difference is the text input. Instead of el.text(), we're editing el.attr("placeholder");

Fade out each typed string

http://jsfiddle.net/mattboldt/68A9b/

This one is quite custom, so you'll have to dig around the code a bit. Here are the main edits:

backspace: function(curString, curStrPos){
  var self = this;         
  self.el.fadeOut(function(){
    self.el.text("");
  });          
  setTimeout(function() {
    curStrPos = 0;
    self.el.fadeIn();
    // *** continue normal code after this point ***
  }, 1000);
}

More to come in the future!

Clone this wiki locally