javascript - 如何检测 Harshen 的 jQuery-countdownTimer 何时达到 00:00
问题描述
我正在集成Harshen Panday 的 countdownTimer 插件,但我想hello
在它到达时打印00:00
。有什么方法可以让我收到该事件的通知?
$(function() {
$('#ms_timer').countdowntimer({
minutes: 03,
seconds: 00,
size: "lg"
});
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script type="text/javascript" src="https://harshen.github.io/jquery-countdownTimer/jquery.countdownTimer.min.js"></script>
<span id="ms_timer" class="d-block mb-2"></span>
<h3 id="getTime" class="mb-3 text-uppercase"><b>Book Consultation</b></h3>
<h5 id="getPrice"><b class="strike">RS. 500</b></h5>
<h2 class="mb-0"><b>RS. 300</b></h2>
解决方案
该文档给出了timeUp:
时间到
- 类型:
Function
- 默认:
null
- 倒计时归零时调用的回调函数的名称。函数内
this
是指保存小部件的分区。不传入任何参数。为此选项提供名称,不带引号。
$(function() {
$('#ms_timer').countdowntimer({
minutes: 00,
seconds: 05,
size: "lg",
timeUp: () => console.log("Hello")
});
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script type="text/javascript" src="https://harshen.github.io/jquery-countdownTimer/jquery.countdownTimer.min.js"></script>
<span id="ms_timer" class="d-block mb-2"></span>
<h3 id="getTime" class="mb-3 text-uppercase"><b>Book Consultation</b></h3>
<h5 id="getPrice"><b class="strike">RS. 500</b></h5>
<h2 class="mb-0"><b>RS. 300</b></h2>
推荐阅读
- optimization - 在 pyscipopt 中,是否可以在我的主要优化模型中使用包含优化模型的函数?
- javascript - 接受clevertap网络推送通知确认后,我很晚才收到基于浏览器的提示确认(允许或阻止通知)
- asp.net - 如何在 Blazor RenderFragment CodeBehind 上正确添加 OnClick 处理程序
- python - 如何使用比例在 Python 中的字典中增加一个值?
- .net-core - Apache Pulsar:使用 DotPulsar 的应用程序
- kubernetes - 带有 go-templates helm3 的 trable
- python - 如何在一个类中正确设置多个依赖属性?
- python-3.x - 将标准输出重定向到文件在某个时候停止
- c++ - UE4 如何使用 UMG ListView 显示结构列表?
- azure-active-directory - 不支持带过滤器的结束