Skip to content

Javascript that types out an array of words like an old typewriter/console

Notifications You must be signed in to change notification settings

thegreyspot/Typey.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Typey.js

A jQuery plugin that prints out provided words, letter by letter, like a typewriter or old console. Similar to what Google I/O 2014 website has. See example here: http://thegreyspot.github.io/Typey.js

Usage

Typey.js requires jQuery and is itself only 2KB. The CSS file contains the helper class for a blinking cursor. It's probably easier to just add it to your own CSS file and cut down on one less HTTP request.

<!--Include these guys -->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script src="jquery.typey.js"></script>
<link href="style.css" type="text/css" rel="stylesheet"> 

<!--- Gets typey going -->
<div id="intro">Hello my name is </div>
<script>
  $("#intro").typey({
  	'words' : ['cat', 'dog', 'mouse']
  });
</script>

Options

<script>
  $("#intro").typey({
  	'words' : ['cat', 'dog', 'mouse'], //Array of words to display
    'typingSpeed' : 100, //Speed at which to type
    'wordDelay' : 400, //Delay between words
    'isInfinite' : true	//Keep cylcing through the 'words' array
  });
</script>

More options

You can set the location of where the words will be typed in the sentence.

Add <span class="typey"></span> where you want the words typed into.

<div>This <span class="typey"></span> is typing with Typey.js</div>

You can also include the array of words, right in the div itself.

<div data-typey-words="robot, computer, ai">I am a </div>

Other things

  • Created by Michael Humphries (@thegreyspot on twitter, and 'thegreyspot' everywhere else on the interwebs)
  • Design help from Rotem K.

About

Javascript that types out an array of words like an old typewriter/console

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published