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 に答える