我正在嘗試製作一個javascript/jquery代碼,它會自動鍵入一個字符串,然後在完全鍵入字符串之後,清除以前鍵入的字符串並再次鍵入它。目前,我所有的代碼都是輸入一次字符串。我知道如何保持循環,但它只是開始鍵入它停止的地方,並且不清除字符串。使用Javascript:如何重複自動鍵入文字
var txt='Typing text...'.split('');
var delay=850;
for (i=0; i<txt.length;i++){
setTimeout(function(){
$('.autoText').append(txt.shift())
}, delay * i)
}
,這裏是我的html:
<h1 class="autoText" style="font-size: 50px; color: #7CFC00; margin-top: 0em; margin-left: 25%;"></h1>
是的,這就是,謝謝 – VampireTooth 2014-08-30 15:59:18