English 中文(简体)
Jquery-UI - Javascript
原标题:Progressbar in Jquery-UI - Javascript

我正在努力更新一条基于两个变量的“进展障碍”:

  • Start the bar at x procent
  • x Minutes to go untill 100%

http://jqueryui.com/demos/progressbar/“rel=“nofollow”http://jqueryui.com/demos/progressbar/ iii

到目前为止,我有:

<script>
$(function() {
    var pGress = setInterval(function() {
        var pVal = $( #progressbar ).progressbar( option ,  value );
        var pCnt = !isNaN(pVal) ? (pVal + 1) : <?php echo $procent_finished; ?>;
        if (pCnt > 100) {
            clearInterval(pGress);
        } else {
            $( #progressbar ).progressbar({value: pCnt});
            $( #progressbar1 ).progressbar({value: pCnt});
        }
    },<?php echo $remaining_minutes; ?>);
});
</script>

“费用-完成”是已完成的%,“持续时间——分钟”应为剩余的分钟至100%。

<>>Example:

我希望酒吧从60%到1分钟开始,达到100%。

  • procent_finished = 60
  • remaining_minutes = 600 (10minutes = 1*6*10 if I m right..)

但是,当我掌握这些变量时,它实际上开始在60%上,但在25秒后已经达到100%。 (在1分钟后,只应当完成100%)

我尝试并寻找了几个公式,以获得正确的剩余时间,但我实际上似乎无法看到。 希望能够帮助我的人,因为我再也不cl。

Thanks in advance!

编辑:如果每分钟都更新进展障碍,只增加百分比,就会更好。

最佳回答

间歇需要双流的间歇,你正在确定600,6秒。 1分钟为600分钟。

因此,每分钟都会更新酒吧,你会这样做。

$(function() {
var percentDone = <?php echo $procent_finished; ?>;
var minute = 0;
var percentIntervals = (100 - percentDone )/<?php echo $remaining_minutes; ?>;

$( #progressbar ).progressbar({value: percentDone});

var pGress = setInterval(function() {
    var nVal = (percentIntervals) * (++minute) + percentDone;
    if (nVal > 100) {
        clearInterval(pGress);
    } else {
        $( #progressbar, #progressbar1 ).progressbar({value: nVal});
    }
}, 60000);
});

<代码>保留-分钟是指左上多分钟的星号。

http://jsfiddle.net/q4WqL/"rel=“nofollow> http://jsfiddle.net/q4WqL/

问题回答

暂无回答




相关问题
WPF Progressbar continue animation

I m using the progress bar of WPF and set the value until the max value. But, when reached, the animation (that s the green effect) continues. How can I stop it and have a full filled green bar, ...

Progress messages - user experience

When displaying progress bars do you display generic messages, such as: "Working" "Loading" "In Progress" Or is the additional coding effort worth the user experience improvements resulting from ...

Adobe Flex Progress Bar for LoadStyleDeclarations

I m loading a rather large swf as style with the following command: StyleManager.loadStyleDeclarations("assets/modules/"style.swf",true,false,ApplicationDomain.currentDomain); The style is loaded ...

Multiline progress bars

I know that to update something like a progress bar on the command line, one uses . Is there any way to update multiple lines?

Flex HTTPService Progressbar

How can I set a progress bar that may start when an HTTPService is sent and stop when the HTTPService ends? I followed code given here but encountered following error: Type was not found or was ...

Display progress bar in the program s task bar icon

I was seeing that when you do somethings at Windows 7 that haves a progress bar, things like downloading a file. You can see that in the programs bar, at the icon of the application, there is the ...

热门标签