天空飘来五个字

html

<p id="content" style="font-size:25px;height:25px;letter-spacing:5px;padding:10px 20px;background-color:#0aa;">天空飘来五个字,那都不是事!</p>

js with jQuery

// 小效果,天空飘来五个字
var showWordOneByOne = function (target) {

    var text = target.text(),
        arrStr = text.split("");            
        tId = null
        word = "";

    target.text("");

    tId = setTimeout(function setWord() {

        word = arrStr.shift();

        target.append(word);

        if (arrStr.length > 0) {
            tId = setTimeout(setWord, 200);
        }
    }, 700);
};

showWordOneByOne($("#content"));
原文地址:https://www.cnblogs.com/xiankui/p/3838384.html