-5
jQuery.noConflict();

jQuery(document).ready(function() {

    // milliseconds
    var intervalTime = 75,

    div = jQuery(".animate"), st = div.text(), timer, count = 0, total = st.length;
    div.html("").css("visibility", "visible");

    timer = setInterval(showLetters, intervalTime);

    function showLetters() {

        if(count < total) {

            div.html(div.text().split("_").join("") + st.charAt(count) + "");
            count++;

        }
        else {

            clearInterval(timer);

        }

    }

});

<div class="animate">Some text here.</div>
4

1 に答える 1

3

Javascriptで何かをするのを「待つ」には、いつでも使用できます

setTimeout(callback, intervalInMillis)

したがって、showLetters()3 秒待ちたい場合は、

setTimeout(showLetters(), 3000);

それが役立つことを願っています!

于 2013-01-27T04:54:21.610 に答える