Jquery一次淡出一个字母。它一下子就消失了。
<script>
$(document).ready(function () {
$('#html1').hide().fadeIn(1000);
});
</script>
我是否必须分割字符串或什么?
答案 0 :(得分:0)
To get the individual letters to fade in, they need to be DOM elements.
var string = $('#html1').html();
$('#html1').html("");
var q = jQuery.map(string.split(''), function (letter) {
return $('<span>'+letter+'</span>');
});
var destination = $('#html1');
var c = 0;
var i = setInterval(function () {
q[c].appendTo(destination).hide().fadeIn(1000);
c += 1;
if (c >= q.length) clearInterval(i);
}, 1000);