[英]Time counter Progress Bar
In my php application I get the numbers of seconds that remains to an event: ex: 6000sec. 在我的php应用程序中,我得到事件剩余的秒数:例如:6000sec。 and the total time since the creation of the event until the end.
以及从创建活动到结束为止的总时间。 Ex: 10000sec.
例如:10000秒。 I want to do a progress bar that take the seconds and, every second, atualize the progress bar.
我想制作一个耗时数秒的进度条,并且每秒都将其标准化。
Basically, I tried with progressbar(), setInterval()
But i need help to do this. 基本上,我尝试使用
progressbar(), setInterval()
但我需要帮助。
$(function() {
var initial = 6000 // need to add seconds to this value every second.
$( "#progressbar" ).progressbar({
value: initial,
max: 10000
});
}); });
Try this and adjust the values to what you want: 尝试此操作,然后将值调整为所需的值:
$(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
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.