Thursday 30 April 2015

var captionLength = 0; var caption = ''; $(document).ready(function() { setInterval ('cursorAnimation()', 600); captionEl = $('#caption'); $('#test-typing').click(function(){ testTypingEffect(); }); }); function testTypingEffect() { caption = $('input#user-caption').val(); type(); } function type() { captionEl.html(caption.substr(0, captionLength++)); if(captionLength < caption.length+1) { setTimeout('type()', 50); } else { captionLength = 0; caption = ''; } }

No comments:

Post a Comment