1

私のphpアプリケーションでは、イベントに残っている秒数を取得します.ex:6000秒. イベントの作成から終了までの合計時間。例:10000秒 数秒かかるプログレスバーを実行し、毎秒、プログレスバーをアチュアライズしたいと考えています。

基本的に、私は試してみましprogressbar(), setInterval()たが、これを行うには助けが必要です。

$(function() {
var initial = 6000 // need to add seconds to this value every second.
$( "#progressbar" ).progressbar({
  value: initial,
  max: 10000
});

});

フィドル

4

1 に答える 1

1

これを試して、必要な値に調整してください。

$(function () {
    var current;
    var max = 10000;
    var initial = 6000; 
    $("#progressbar").progressbar({
        value: initial,
        max: max
    });

    function update() {
        current = initial; //the value on each function call
        $("#progressbar").progressbar({
            value: current
        });
        if (current >= max) clearInterval(interval);
        initial += 1000; //choose how fast to the number will grow
        console.log(current);
    };
    var interval = setInterval(update, 1000); //choose how fast to update
});

デモはこちら

于 2013-09-23T18:59:50.680 に答える