0

我想用 jquery "Fade Effect" 每 3 秒更改一次 ap 的文本:

<p class="first">Conected</p>

<p class="second">2547</p>
4

2 回答 2

3

您可以使用 setInterval https://developer.mozilla.org/en-US/docs/DOM/window.setInterval

setInterval(function() {
    $('p').fadeOut(500, function() {
        var $this = $(this);
        $this.text($this.text() == 'Connected' ? '2457' : 'Connected');        
        $this.toggleClass('first second');        
        $this.fadeIn(500);
    });
}, 3000);​

http://jsfiddle.net/wirey00/E4xqg/

于 2012-08-17T16:51:52.750 回答
-1

setInterval 或等待

setInterval http://www.w3schools.com/js/js_timing.asp

JQuery 等待 http://api.jquery.com/delay/

于 2012-08-17T16:42:53.817 回答