JQUERY插件-JQUERY+BOOTSTRAP4进度条计时器插件

此一款为jQuery与bootstrap4进度条的计时器插件。该插件因bootstrap4者数条显示计时的进度,并给倒漏毕之回调函数。

使用方法

在页面中引入jQuery、bootstrap4相关文件,以及jquery.progressBarTimer.min.js文件。

<link rel="stylesheet" type="text/css" href="assets/css/bootstrap-min.css" />
<script type="text/javascript" src="assets/js/jquery.min.js"></script>
<script type="text/javascript" src="assets/js/bootstrap.min.js"></script>
<script type="text/javascript" src="assets/js/jquery.progressBarTimer.min.js"></script>

HTML结构

TourJS 使用一个块级元素作为倒计时器的容器。

<div id="countdown"></div>

初始化插件

然后在页面DOM元素加载完毕之后,通过下面的方法来初始化该倒计时器插件。

$("#countdown").progressBarTimer({
  timeLimit: 60,
  warningThreshold: 5,
  autostart: false,
  onFinish  : function () { console.log('completed') }
}).start()

配置参数

该倒计时器插件的可用配置参数如下:

{
  timeLimit: 60, //total number of seconds
  warningThreshold: 5, //seconds remaining triggering switch to warning color
  autoStart: true, // start the countdown automatically
  onFinish: function() {}, //invoked once the timer expires
  baseStyle: '', //bootstrap progress bar style at the beginning of the timer
  warningStyle: 'bg-danger', //bootstrap progress bar style in the warning phase
  smooth: false, // should the timer be smooth or stepping
  completeStyle: 'bg-success' //bootstrap progress bar style at completion of timer
}

方法

该倒计时器插件的可用方法和回调函数如下:
.start():开始倒计时。
.stop():结束倒计时,onComplete方法不会被执行。
.extendTimer(secs):延长当前的倒计时时间。
.addSeconds(secs):在原有倒计时时间的基础上增加时间,如果startOverAfterAdding设置为true,则重新开始倒计时。
onComplete:倒计时结束后的回调函数。

源码来源:https://github.com/imalliar/jquery.progressBarTimer

在线预览 网盘下载

郑重声明:

1 本资源来源于互联网,资源的版权归资源原作者所持有,受《中华人民共和国著作权法》等相关法律保护。

2 由于无法和原作者取得联系,所以上传的部分资源无法先通过原作者的同意就分享给大家了,如本资源侵犯了您(原作者)的权益,请联系我们(微信号 xiaohaimei1989),我们会立马删除您的资源,并向您表达诚挚的歉意!

3 本站是一个公益型网站,分享资源的目的在于传播知识,分享知识,收取一点点打赏的辛苦费是用于网站的日常运营开支,并非用于商业用途。

4 本站资源只提供学习和参考研究使用,使用过后请在第一时间内删除。本站不承担资源被单位或个人商用带来的法律责任。

发表评论