1

私はjQueryタイマーを動かしていますが、2サイクル後に台無しになっているようです:treethink.treethink.net/backup

現在、さまざまなタイマーで、ニュース ティッカーが撤回され、表示されている div が変更されてから、再びポップアウトされます。上のリンクでわかるように、数サイクル後、一部は長く留まり、重なり合って混乱します. なぜこれが起こっているのかわかりません...

これが私のコードです:

/* Retracting Ticker */

    /* Initially hide all news items */

    $('#ticker1').hide();
    $('#ticker2').hide();
    $('#ticker3').hide();

    $("#ticker1").oneTime(1000,function(i) { /* Show 1 once on first pull out */

        $('#ticker1').show();

    });

    $("#ticker1").everyTime(64500,function(i) { /* Hide 3 and show 1 everytime timer gets to certain point */

        $('#ticker1').show();

    });

    $("#ticker1").oneTime(21500,function(i) { /* Hide 1 and show 2 once after first pull out */

        $('#ticker1').hide();
        $('#ticker2').show();

    });

    $("#ticker1").everyTime(86000,function(i) { /* Hide 1 and show 2 everytime timer gets to certain point */

        $('#ticker1').hide();
        $('#ticker2').show();

    });


    $("#ticker2").oneTime(43000,function(i) { /* Hide 2 and show 3 once after second pull out */

        $('#ticker2').hide();
        $('#ticker3').show();

    });

    $("#ticker2").everyTime(107500,function(i) { /* Hide 2 and show 3 everytime timer gets to certain point */

        $('#ticker2').hide();
        $('#ticker3').show();

    });

    $("#ticker3").oneTime(64000,function(i) { /* Hide 2 and show 3 once after second pull out */

        $('#ticker3').hide();

    });

    $("#ticker3").everyTime(129000,function(i) { /* Hide 2 and show 3 everytime timer gets to certain point */

        $('#ticker3').hide();

    });

    $("#ticker").oneTime(2000,function(i) { /* Do the first pull out once */

        $("#ticker").animate({right: "0"}, {duration: 800 });
    });

    $("#ticker").oneTime(20000,function(i) { /* Do the first retract once */

        $("#ticker").animate({right: "-450"}, {duration: 800});

    });

    $("#ticker").everyTime(21500,function(i) { /* Everytime timer gets to certain point */

        $("#ticker").animate({right: "0"}, {duration: 800}); /* Pull out right away */

        $("#ticker").oneTime(20000,function(i) { /* Retract once */

            $("#ticker").animate({right: "-450"}, {duration: 800});

        });

    });

ありがとう、

ウェイド

4

1 に答える 1

2

oneTimeあなたを台無しにするつもりはないので、すべての s を無視しましょう。

$("#ticker1").everyTime(64500,function(i) {
    $('#ticker1').show();
});

$("#ticker1").everyTime(86000,function(i) { 
    $('#ticker1').hide();
    $('#ticker2').show();
});

$("#ticker2").everyTime(107500,function(i) {
    $('#ticker2').hide();
    $('#ticker3').show();
});

$("#ticker3").everyTime(129000,function(i) { 
    $('#ticker3').hide();
});

$("#ticker").everyTime(21500,function(i) { 
    $("#ticker").animate({right: "0"}, {duration: 800});
    $("#ticker").oneTime(20000,function(i) { 
        $("#ticker").animate({right: "-450"}, {duration: 800});
    });
});

ティッカー、コンテナー、および 3 つのメッセージの 4 つのオブジェクトがあります。

コンテナーの動作は次のとおりです (おおよそ、最初の引き出しは数えません): 21.5 秒ごとに、1.5 秒間非表示になり、スライドして戻ります。これは問題の原因ではありません。3 つのメッセージ タイマーが問題です。

これは、間隔でのメッセージの動作です。

ticker    show (s)   hide (s)
1         64.5       86
2         86         107.5
3         107.5      129

編集最初のティッカー間隔時間の数字が間違っていましたが、それでも考え方は同じだと思います。やがて時代は重なる。

于 2010-02-05T21:12:29.387 に答える