CountDown.js
一个用来实现简单页面倒计时的轻量级工具
API
CountDown.openTimeCountBySeconds()根据要计时的秒数打开一个显示剩余时间的倒计时
参数:
ps:以上均为可选参数
示例
CountDown.openTimeCountBySeconds({
Ele: document.getElementById('h1'),
CountDownSeconds: 3600,
Sign: 'flypie',
Divider: ':',
EndFunc: function () {
console.log('end');
}
});
CountDown.openTimeCountByStartAndEndDate()根据计时开始和结束时间打开一个显示剩余时间的倒计时
参数:
ps:除StartDate,EndDate外均为可选参数
示例
var startDate = new Date();
var endDate = new Date();
endDate.setDate(endDate.getDate()+1);
CountDown.openTimeCountByStartAndEndDate({
Ele: document.getElementById('h1'),
StartDate: startDate,
EndDate: endDate,
Sign: 'flypie',
Divider: ':',
EndFunc: function () {
console.log('end');
}
});
CountDown.openTimeCountByStartAndEndDate()根据计时开始和结束时间打开一个显示剩余天数加时间的倒计时
参数:
ps:除StartDate,EndDate外均为可选参数
示例
var startDate = new Date();
var endDate = new Date();
endDate.setDate(endDate.getDate()+10);
CountDown.openDateAndTimeCountByStartAndEndDate({
Ele: document.getElementById('h1'),
StartDate: startDate,
EndDate: endDate,
Sign: 'flypie',
Divider: ':',
DateDivider: '天 ',
EndFunc: function () {
console.log('end');
}
});
CountDown.stopBySign()根据标记零时暂停一个倒计时
CountDown.stopBySign('flypie');
CountDown.resumeBySign()根据标记恢复一个被零时暂停的倒计时
CountDown.resumeBySign('flypie');
CountDown.closeBySign()根据标记永久性地关闭一个倒计时
CountDown.closeBySign('flypie');
总结
Copyright © 2019- cepb.cn 版权所有 湘ICP备2022005869号-7
违法及侵权请联系:TEL:199 18 7713 E-MAIL:2724546146@qq.com
本站由北京市万商天勤律师事务所王兴未律师提供法律服务