jQuery倒计时插件重启
我正在使用jQuery倒计时插件(),但我似乎无法重置计时器 单击按钮后,以下功能开始倒计时:jQuery倒计时插件重启,jquery,plugins,timer,countdown,Jquery,Plugins,Timer,Countdown,我正在使用jQuery倒计时插件(),但我似乎无法重置计时器 单击按钮后,以下功能开始倒计时: function startResetCounter() { $('.reset_counter div').countdown({ until: '+3m +0s', compact: true, format: 'MS', onExpiry: resetPage }); } 但当我重新点击按钮时,它不会重置计时器
function startResetCounter() {
$('.reset_counter div').countdown({
until: '+3m +0s',
compact: true,
format: 'MS',
onExpiry: resetPage
});
}
但当我重新点击按钮时,它不会重置计时器
有谁能帮我吗?添加到startResetCounter函数的下面一行:
$('.reset_counter div').countdown('destroy'); //remove countdown if it was already used
因此,在结束时,您将得到:
function startResetCounter() {
$('.reset_counter div').countdown('destroy');
$('.reset_counter div').countdown({
until: '+3m +0s',
compact: true,
format: 'MS',
onExpiry: resetPage
});
}