阅读背景:

js - 倒计时

来源:互联网 
/* * @ 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); /* * @ qp * 倒计时 * $.qpTime({ s: 开始, // 时间戳 / Date



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: