js实现打字机效果

it2022-05-05  82

var s = 'Hello World! Hello World! Hello World!'; var con = $('.container'); var index = 0; var length = s.length; var tId = null; function start(){ con.text(''); tId=setInterval(function(){ con.append(s.charAt(index)); if(index++ === length){ clearInterval(tId); index = 0; start() } },100); } start();

 

参考:http://www.cnblogs.com/dolphinX/p/4087817.html

转载于:https://www.cnblogs.com/wteng/p/5440364.html

相关资源:javascript实现的打字机效果

最新回复(0)