Web/image/specialSale.js

(开头部分) 7KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

/*!
* 特卖
* @auth: qh
*/

/*!
* 倒计时函数 TimeCountDown
* 
* @para { String } options 传入的参数 
* options.time 距离结束时间(毫秒) options.type 显示类型('ms'为显示到毫秒,不传则显示到秒)
* options.callback 业务处理的回调函数 options.end 倒计时结束触发的回调函数
*
* 支持jQuery,Zepto 
*
*/
;(function (w) {
	var noop = function () {},
	    offloadFn = function (fn) { setTimeout(fn || noop, 0) };
	
	TimeCountDown = function (options) {
		var _default = {
			end: noop
		};
		
		this.options = $.extend({}, _default, options);
		
		this.times = Number(options.time) || 0;
		
		this.init();
	};
	
	TimeCountDown.prototype.init = function () {
		this.setup();
	}
	
	TimeCountDown.prototype.setup = function () {
		if (this.options.type === 'ms') {
			// 显示到毫秒时的时间间隔 0.1s
			this.speed = 100;
		} else {
			// 显示到秒的时间间隔 1s
			this.speed = 1000;
		}
		this.time();
	}
		
	TimeCountDown.prototype.fillZero = function (num, digit) {
		var str = '' + num;
		digit = digit || 2;
		
		while (str.length < digit) {
			str = '0' + str;
		}
		
		return str;
	}
	
	TimeCountDown.prototype.time = function () {
		var result = null,
			_time = this.times,
后面还有 236 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。