這裏有一個工作的jsfiddle: http://jsfiddle.net/Skg7d/19/
var strn = "It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like).";
var wordsPerInterval = 3,
duration = 500,
el = $('p'),
words = strn.split(' ');
el.html('');
var interval = setInterval(function() {
var toInsert = words.slice(0, wordsPerInterval);
words = words.slice(wordsPerInterval, words.length);
if (toInsert.length)
el.html(el.html() + toInsert.join(' ') + ' ');
else
clearInterval(interval);
}, duration);
你是什麼意思與*「它只爲第一個實例工作」*?請創建一個http://jsfiddle.net/演示。 –
jsfiddle演示的+1。 – Skilldrick
小提琴在未定義變量'grupof'上失敗。 :( –