Created
December 5, 2013 16:12
-
-
Save shanejdonnelly/7808207 to your computer and use it in GitHub Desktop.
Typewriter effect
http://stackoverflow.com/questions/4074399/what-to-choose-for-typewriter-effect-in-javascript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.fn.teletype = function(opts){ | |
var $this = this, | |
defaults = { | |
animDelay: 50 | |
}, | |
settings = $.extend(defaults, opts); | |
$.each(settings.text.split(''), function(i, letter){ | |
setTimeout(function(){ | |
$this.html($this.html() + letter); | |
}, settings.animDelay * i); | |
}); | |
}; | |
//To use: | |
$('#container').teletype({ | |
animDelay: 100, // the bigger the number the slower the typing | |
text: 'Text to be typed here.' | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment