如何逐个显示每个()jquery的循环元素,比如在两者之间有延迟?
function text_animate(){
var get_text=$("#animated_text_falling h1").text();
var words =get_text.split(" ");
$("#animated_text_falling h1").remove("h1");
var wordCount = 0;
$.each(words, function(key, value) {
var $word= $('<div id= word_' + key + '>' + value + '</div>').appendTo('#animated_text_falling').show();
//here somhow to show $('<div id= word_' + key + '>' + value + '</div>') with delay
wordCount++;
});
}
答案 0 :(得分:0)
尝试使用.delay()
function text_animate(){
var get_text=$("#animated_text_falling h1").text();
var words =get_text.split(" ");
$("#animated_text_falling h1").remove("h1");
var wordCount = 0;
var delayCount = 0;
$.each(words, function(key, value) {
delayCount = delayCount + 1000;
var $word= $('<div id= word_' + key + '>' + value + '</div>').appendTo('#animated_text_falling').delay(delayCount).show();
//here somhow to show $('<div id= word_' + key + '>' + value + '</div>') with delay
wordCount++;
});
}