从计时器倒计时

Pet*_*Web 2 javascript jquery countdown

有没有办法让倒计时60秒......这是计时器的代码:

var count = 0;
var timer = $.timer(function() {
    $('#counter').html(++count);
});
timer.set({ time : 1000, autostart : true });
Run Code Online (Sandbox Code Playgroud)

我需要喋喋不休地使这个代码像倒计时>谢谢

Ell*_*lle 10

计数从0到60.

var count = 0, timer = setInterval(function() {
    $("#counter").html((count++)+1);
    if(count == 59) clearInterval(timer);
}, 1000);
Run Code Online (Sandbox Code Playgroud)

或者从60到0:

var count = 60, timer = setInterval(function() {
    $("#counter").html(count--);
    if(count == 1) clearInterval(timer);
}, 1000);
Run Code Online (Sandbox Code Playgroud)