我在我的项目(http://hilios.github.io/jQuery.countdown/)中使用Jquery倒计时。我想在计数器结束前5分钟(显示警报)和计数器结束后10分钟警告用户。在网站文档中,我看到了一个名为elapsed的事件,它提供了时间已过去的信息。
有什么建议吗?我的猜测是我必须处理事件调用finaldate。
问题已解决。为了警告用户,我在更新回调中使用了offset.minutes事件。这是代码
flag2 = true;
$('#clock').countdown(dateseance, { elapse: true }).on('update.countdown', function (event) {
if (event.offset.minutes == (4) && flag2) {
alert("Less than 5 minutes before the end of counter");
flag2 = false;
}
我们使用flag2仅显示一次警报。因此,当计数器达到4mn 59 s时,将显示警报。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句