这里有一个工作的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'上失败。 :( –