你需要赶上特定的分钟和秒,我需要看到饲料。 HTML SPAN:
<span class="minutes">0</span>:
<span class="seconds">00</span>
JQuery的:
function count_timesong(end_time){
var time_parts = end_time.split(':');
var minutes = time_parts[0];
var seconds = time_parts[1];
$('.minutes').countTo({from: 0, to: minutes,speed: 600000});
$('.seconds').countTo({from: 00, to: seconds,speed: 10000});
}
我需要每60秒增加一分钟,并在到达end_time时停止(例如4:38)
答案 0 :(得分:0)
试试吧,
var totalSeconds = 0;
var clr = setInterval(setTime, 1000);
var endMinute=1;
var endSecond=5;
function setTime() {
++totalSeconds;
var s=totalSeconds % 60,
m=parseInt(totalSeconds / 60);
if(s==endSecond && m==endMinute) {
clearInterval(clr);
}
$('#seconds').text(s);
$('#minutes').text(m);
}
<强> DEMO 强>
更新了演示