Jake Paris

Fade-in text: jQuery plugin

This is a basic plugin for jQuery which adds an effect for slowly fading in text. There may be other plugins out there that have similar functionality, but this was an attempt to try building such a thing.


See the Pen Fade In Text by Jake P (@jakeparis) on CodePen.0

The Code

	typewrite: function(userArgs){

		var me = this;
		var args = {
			speed: 60,
			callback: false,
			fadeIn: true
		if(typeof userArgs == 'number')
			args.speed = userArgs;
		else {
			args = jQuery.extend(args,userArgs);

		var msg = me.text();
		if( ! msg )
			return false;

		// stop bump
		me.html('<span style="z-index: 0; opacity: 0;">'+msg+'</span>');
		me.prepend('<span id="typewriter-text" style="z-index: 50; position: absolute;"></span>');
		$tt = jQuery('#typewriter-text');

		msg = msg.split('');
		var letter;
		var typewriterInterval = window.setInterval(function(){
			if(msg.length) {
				letter = msg.shift();
				if(! args.fadeIn) {

				letter = '<span class="typewriter-fade-letter" style="display: none;">' + letter + '</span>';
			} else {
				if(typeof args.callback == 'function')

Make a Comment

All fields are required. No one will see your email other than me.