Web/js/slideunlock/jquery.slideunlock.js

(开头部分) 5KB

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

/**
* Author: Arron.y
* Email: yangyun4814@gmail.com
* Github: https://github.com/ArronYR
* CreateTime: 2016-03-11
*/

'use strict'

// 滑动条对象
function SliderUnlock(elm, options, success, always) {
    var _self = this;

    var $elm = _self.checkElm(elm) ? $(elm) : $;
    var options = _self.checkObj(options) ? options : new Object();
    var success = _self.checkFn(success) ? success : function(){};
    var always = _self.checkFn(always) ? always : function(){};

    var opts = {
        labelTip: typeof(options.labelTip)!=="undefined" ? options.labelTip : "Slide to Unlock",
        successLabelTip: typeof(options.successLabelTip)!=='undefined' ? options.successLabelTip : "Success",
        duration: typeof(options.duration)!=='undefined'||!isNaN(options.duration) ? options.duration : 500,
        swipestart: typeof(options.swipestart)!=='undefined' ? options.swipestart : false,
        min: typeof(options.min)!=='undefined'||!isNaN(options.min) ? options.min : 0,
        max: typeof(options.max)!=='undefined'||!isNaN(options.max) ? options.max : $elm.width(),
        index: typeof(options.index)!=='undefined'||!isNaN(options.index) ? options.index : 0,
        IsOk: typeof(options.isOk)!=='undefined' ? options.isOk : false,
        lableIndex: typeof(options.lableIndex)!=='undefined'||!isNaN(options.lableIndex) ? options.lableIndex : 0
    }

    //$elm
    _self.elm = $elm;
    //opts
    _self.opts = opts;
    //是否开始滑动
    _self.swipestart = opts.swipestart;
    //最小值
    _self.min = opts.min;
    //最大值
    _self.max = opts.max;
    //当前滑动条所处的位置
    _self.index = opts.index;
    //是否滑动成功
    _self.isOk = opts.isOk;
    //鼠标在滑动按钮的位置
    _self.lableIndex = opts.lableIndex;
    //success
    _self.success = success;
    //always
    _self.always = always;
}

// 检测元素是否存在
SliderUnlock.prototype.checkElm = function (elm) {
    if($(elm).length > 0){
        return true;
    }else{
        throw "this element does not exist.";
    }
};
后面还有 135 行代码,购买后查看完整代码

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

AI 解读

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

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