/*
* @ qp
* 倒计时
*
$.qpTime({
s: 开始, // 时间戳 / Date
e: 结束,
m: 毫秒
}, function (e) {
e = {
d: 天,
h: 时,
m: 分,
s: 秒,
i: 毫秒,
t: 时间戳
}
});
*
*/
(function(j) {
j.extend({
qpTime (a, b) {
var t = this.t,
n = new Date(),
k = a.m ? 100 : 1e3,
l = a.e - a.s;
t = setInterval(z, k);
z();
function z() {
var c = l - (new Date - n),
d = {
d: '00',
h: '00',
m: '00',
s: '00',
i: '00',
t: 0
};
0 < c ? (d = {
d: y(Math.floor(c / 1e3 / 60 / 60 / 24)),
h: y(Math.floor(c / 1e3 / 60 / 60 % 24)),
m: y(Math.floor(c / 1e3 / 60 % 60)),
s: y(Math.floor(c / 1e3 % 60)),
i: y(Math.floor(c % 1e3 / 10)),
t: c
}) : clearInterval(t);
return b(d);
}
function y(e) {
return 10 > e ? '0' + e : e;
}
}
});
})(jQuery);
js - 倒计时
猜你喜欢
转载自blog.csdn.net/NaShiShiWo/article/details/89923540
今日推荐
周排行