• jquer_shijian 增加初始化 年月日 及 结束时间 年月日


    增加了插件 在初始化的时候,控制 年月日,和结束 年月日

    $(time_createobj).siblings(".xtw_budget_userdatafn_hide").shijian({
                    showNowTime:false,
                    startYear:2009,
                    startMonh:'12',
                    startDay:'07',
                    val:2010,
                    endYear:2021,
                    endMonh:'05',
                    endDay:'11',
                    Year:true,//是否显示年//
                    Month:true,//是否显示月//
                    Day:true,//是否显示日//
                    Hour:false,
                    Hour2:false,
                    Minute:false,
                    h:"00",
                    h2:"00",
                    yyyy: nowyear, //设置起始值//
                    mm: nowmonth,
                    dd: nowday,
                    alwaysShow:true,
                    timeElm:$(".time-box"),//sjObj表示当前对象  也可以使用 sjObj  用字符串
                    //timeElm:"sjObj.prev()",// 也可以使用 sjObj  用字符串  sjObj 表示当前input
                })

    jjs 源码:

    (function () {
        function fillZero(x) {
            if (x < 10) {
                return x = "0" + x;
            } else {
                return "" + x;
            }
        };$.fn.shijian = function (opt) {
            function cPlugin(o, emlnum) {
                var sjObj = o;
                console.log(sjObj)
                sjObj.defaults = {
                    type: "time",
                    Format: "yyyy-mm-dd",
                    timeFormat: "h:m:s",
                     60,
                    height: 32,
                    Year: true,
                    Month: true,
                    Day: true,
                    Hour: true,
                    Hour2: true,
                    Minute: true,
                    Seconds: false,
                    yyArr: [],
                    mmArr: [],
                    ddArr: [],
                    hArr: [],
                    mArr: [],
                    sArr: [],
                    yyyy: "2000",
                    mm: "01",
                    dd: "01",
                    h: "01",
                    m: "01",
                    s: "01",
                    val: null,
                    // yearText: "年",
                    // monthText: "月",
                    // dayText: '日',
                    // hourText: '时',
                    // minuteText: '分',
                    // secondsText: '秒',
                    okText: "确认",
                    cancelText: "取消",
                    thisElm: null,
                    showNowTime: true,
                    alwaysShow: false,
                    timeElm: null,
                    isparseInt: false,
                    finalshow: true,
                    boxClassName: "",
                    onfun: function (sjObj) {
                    },
                    okfun: function (sjObj) {
                    },
                    t_box: null,
                    df_persp: function () {
                        return $("<div class='df-persp'><div class='persp-bg'></div>")
                    },
                    df_box: function () {
                        return $("</div><div class='df-box " + (sjObj.opt.alwaysShow ? "alwaysShow" : "") + " " + sjObj.opt.boxClassName + "' style='line-height:" + sjObj.opt.height + "px;'></div>")
                    },
                    df_main: function () {
                        return $("<div class='df-main all-flex all-justify-justify all-align-items-center'>")
                    },
                    df_btn: function () {
                        if (sjObj.opt.alwaysShow) {
                            return
                        }
                        return $("<div class='df-btn' style='height:" + sjObj.opt.height + "px'><div class='df-ok'>" + sjObj.opt.okText + "</div><div class='df-no'>" + sjObj.opt.cancelText + "</div></div>")
                    },
                    df_wrap: function () {
                        return $("<div class='df-wrap'><table><tbody><tr></tr></tbody></table></div>")
                    },
                    df_final: function () {
                        return $("<div class='df-final'></div>")
                    },
                    getArr: function () {
                        for (var i = 0; i < 61; i++) {
                            if (i < 12) {
                                this.mmArr[i] = (i + 1);
                            }
                            if (i < 31) {
                                this.ddArr[i] = (i + 1);
                            }
                            // 这里定义小时范围
                            if (i < 25) {
                                this.hArr[i] = i;
                            }
                            ;
                            if (i < 60) {
                                this.mArr[i] = i;
                                this.sArr[i] = i;
                            }
                            if (i < 61 && !sjObj.opt.Year && !sjObj.opt.Month && !sjObj.opt.Day && !sjObj.opt.Hour) {
                                this.mArr[i] = i;
                            }
                        }
                    },
                    y: 10,
                    nowTime: new Date(),
                    startYear: null,
                    endYear: null,
                    ampmText: null,
                    dataNum: 0,
                    strStart: function (text, c) {
                        var df = this;
                        var str;
                        var text = text || "";
                        // console.log(this);
                        if (df.width) {
                            str = '<div class="df-class">' + text + '</div><div class="df-item " style="height:' + (df.height * 5 - 1) + 'px;min-' + df.width + 'px"><ul class="df-ul" data-class=' + c + '>';
                        } else {
                            str = '<div class="df-class">' + text + '</div><div class="df-item " style="height:' + (df.height * 5 - 1) + 'px"><ul class="df-ul" data-class=' + c + '>';
                        }
                        sjObj.opt.dataNum++;
                        return str;
                    },
                    strEnd: function () {
                        var df = this;
                        return "</ul><div class='G-bg'><div class='G-top' style='height:" + (df.height * 2) + "px'></div><div class='G-mid' style='height:" + df.height + "px'></div><div class='G-btm' style='height:" + (df.height * 2) + "px'></div></div></div>"
                    },
                    fillZero: function (x) {
                        if (x < 10) {
                            return x = "0" + x;
                        } else {
                            return "" + x;
                        }
                    },
                    getYear: function () {
                        if (!this.startYear) {
                            var y = sjObj.opt.y || 10;
                            nowTime = new Date();
                            for (var x = this.y, i = 0; x != 0; y > 0 ? x-- : x++, i++) {
                                if (y < 0) {
                                    sjObj.opt.yyArr[i] = nowTime.getFullYear() + x + 1;
                                } else {
                                    sjObj.opt.yyArr[i] = nowTime.getFullYear() + i;
                                }
                            }
                            sjObj.opt.getArr()
                        } else {
                            if (sjObj.opt.yyArr.length > 1) {
                                console.log("年份", sjObj.opt.yyArr);
                                return;
                            }
                            var endYear = this.endYear || parseInt(sjObj.opt.y) + parseInt(this.startYear);
                            var y = -(endYear - parseInt(this.startYear));
                            nowTime = new Date(endYear + "/01/01");
                            console.log("自定义起始年份", endYear, y, nowTime);
                            for (var x = y, i = 0; y > 0 ? x != 0 : x < 1; y > 0 ? x-- : x++, i++) {
                                if (y < 0) {
                                    sjObj.opt.yyArr[i] = nowTime.getFullYear() + x;
                                    // console.log(x, sjObj.opt.yyArr[i]);
                                } else {
                                    sjObj.opt.yyArr[i] = nowTime.getFullYear() + i;
                                }
                            }
                            sjObj.opt.getArr()
                        }
                    },
                    setCenter: function () {
                        var wid = $(window).width();
                        var tabWid = null;
                        var mWid = 0;
                        $(".df-wrap table").each(function () {
                            tabWid += parseFloat($(this).width());
                        })
                        if (tabWid > wid) {
                            $(".df-wrap table").each(function () {
                                mWid = parseFloat($(this).width()) > mWid ? parseFloat($(this).width()) : mWid;
                            })
                            $('.df-box').width(mWid);
                        } else {
                            $('.df-box').width(tabWid + 10)
                        }
                    },
                    buildArrStr: function (Arr, txt, c) {
                        var str = this.strStart(txt, c);
                        $.each(Arr, function () {
                            str += '<li class="df-li df-show"  data-val=' + sjObj.opt.fillZero(this) + ' style="line-height:' + sjObj.opt.height + 'px;height:' + sjObj.opt.height + 'px">' + sjObj.opt.fillZero(this) + '</li>'
                        })
                        // console.log(Arr)
                        str += sjObj.opt.strEnd();
                        return str;
                    },
                    buildHTml: function () {
                        var wrap = sjObj.opt.df_wrap();
                        sjObj.opt.t_box = sjObj.opt.df_box();
                        var main = sjObj.opt.df_main();
                        var persp = sjObj.opt.df_persp();
                        // console.log(sjObj.opt.t_box);
                        if (sjObj.opt.alwaysShow) {
                            sjObj.opt.timeElm = eval(sjObj.opt.timeElm);
                            // console.log(sjObj.opt.timeElm)
                            sjObj.opt.timeElm.append(sjObj.opt.t_box.append(main.append(wrap)));
                        } else {
                            sjObj.opt.timeElm = $("<div class='df-persp'><div class='persp-bg'></div>");
                            sjObj.opt.timeElm.append(sjObj.opt.t_box.append(sjObj.opt.finalshow ? sjObj.opt.df_final : "").append(main.append(wrap)).append(sjObj.opt.df_btn));
                            $('body').append(sjObj.opt.timeElm)
                        }
                        if (sjObj.opt.ampmText) {
                            main.append("<div class='df-wrap'><table><tbody><tr><td>" + sjObj.opt.buildAmPmStr() + "</tr></tbody></table></div>")
                        }
                        if (sjObj.opt.Format == "dd-mm-yyyy") {
                            if (sjObj.opt.Day) $(sjObj.opt.timeElm.find('.df-wrap')[0]).find('tr').append("<td>" + sjObj.opt.buildArrStr(sjObj.opt.ddArr, sjObj.opt.dayText, "dd") + "</td>");
                            if (sjObj.opt.Month) $(sjObj.opt.timeElm.find('.df-wrap')[0]).find('tr').append("<td>" + sjObj.opt.buildArrStr(sjObj.opt.mmArr, sjObj.opt.monthText, "mm") + "</td>");
                            if (sjObj.opt.Year) $(sjObj.opt.timeElm.find('df-wrap')[0]).find('tr').append("<td>" + sjObj.opt.buildArrStr(sjObj.opt.yyArr, sjObj.opt.yearText, "yyyy") + "</td>");
                        } else if (sjObj.opt.Format == "mm-dd-yyyy") {
                            if (sjObj.opt.Month) $(sjObj.opt.timeElm.find('.df-wrap')[0]).find('tr').append("<td>" + sjObj.opt.buildArrStr(sjObj.opt.mmArr, sjObj.opt.monthText, "mm") + "</td>");
                            if (sjObj.opt.Day) $(sjObj.opt.timeElm.find('.df-wrap')[0]).find('tr').append("<td>" + sjObj.opt.buildArrStr(sjObj.opt.ddArr, sjObj.opt.dayText, "dd") + "</td>");
                            if (sjObj.opt.Year) $(sjObj.opt.timeElm.find('.df-wrap')[0]).find('tr').append("<td>" + sjObj.opt.buildArrStr(sjObj.opt.yyArr, sjObj.opt.yearText, "yyyy") + "</td>");
                        } else {
                            if (sjObj.opt.Year) $(sjObj.opt.timeElm.find('.df-wrap')[0]).find('tr').append("<td>" + sjObj.opt.buildArrStr(sjObj.opt.yyArr, sjObj.opt.yearText, "yyyy") + "</td>");
                            if (sjObj.opt.Month) $(sjObj.opt.timeElm.find('.df-wrap')[0]).find('tr').append("<td>" + sjObj.opt.buildArrStr(sjObj.opt.mmArr, sjObj.opt.monthText, "mm") + "</td>");
                            if (sjObj.opt.Day) $(sjObj.opt.timeElm.find('.df-wrap')[0]).find('tr').append("<td>" + sjObj.opt.buildArrStr(sjObj.opt.ddArr, sjObj.opt.dayText, "dd") + "</td>");
                        }
                        if (sjObj.opt.Hour) {
                            var eml = sjObj.opt.df_wrap();
                            $(eml).find('tr').append("<td>" + sjObj.opt.buildArrStr(sjObj.opt.hArr, sjObj.opt.hourText, "h") + "</td>")
                            main.append(eml);
                        }
                        if (sjObj.opt.Hour2) {
                            var eml = sjObj.opt.df_wrap();
                            $(eml).find('tr').append("<td>" + sjObj.opt.buildArrStr(sjObj.opt.hArr, sjObj.opt.hour2Text, "h2") + "</td>")
                            main.append(eml);
                        }
                        ;
                        if (sjObj.opt.Minute) {
                            var eml = sjObj.opt.df_wrap();
                            $(eml).find('tr').append("<td>" + sjObj.opt.buildArrStr(sjObj.opt.mArr, sjObj.opt.minuteText, "m") + "</td>");
                            main.append(eml);
                        }
                        ;
                        if (sjObj.opt.Seconds) {
                            var eml = sjObj.opt.df_wrap();
                            $(eml).find('tr').append("<td>" + sjObj.opt.buildArrStr(sjObj.opt.sArr, sjObj.opt.secondsText, "m") + "</td>");
                            main.append(eml);
                        }
                        if (sjObj.opt.showNowTime) {
                            if (emlnum) {
                                var val = sjObj.value, sjeml = sjObj;
                            } else {
                                var val = sjObj[0].value, sjeml = sjObj[0];
                            }
                            if (val) {
                                // console.log("input中有值", val);
                                // console.log(val.indexOf(" "));
                                if (val.indexOf("/") != -1) {
                                    val = val.replace(///g, "-")
                                }
                                if (val.indexOf(" ") != -1) {
                                    var valarr = val.split(" ");
                                } else {
                                    var valarr = [val];
                                }
                                // console.log("拆分后", valarr);
                                var nyr, sfm;
                                var str = "";
                                if (valarr.length == 2) {
                                    nyr = valarr[0];
                                    sfm = valarr[1];
                                    str += getnyrstr(nyr) + " " + getsfmstr(sfm);
                                } else if (valarr.length == 1 && (valarr.indexOf("-") != -1 || valarr.indexOf("/") != -1)) {
                                    str += getnyrstr(valarr[0]) + " " + getsfmstr("")
                                    // console.log("组合 2");
                                } else {
                                    if (sjObj.opt.Year || sjObj.opt.Month || sjObj.opt.Day) {
                                        str += getnyrstr(valarr[0]) + " " + getsfmstr("")
                                    } else {
                                        str += getnyrstr("") + " " + getsfmstr(valarr[0])
                                    }
                                    console.log("组合 3");
                                }
                                console.log("合成字符串", str)
                                data = new Date(str.replace(/-/g, "/"));
                            } else {
                                var data = new Date();
                            }
                            console.log(data);
                            var year = data.getFullYear();
                            var month = data.getMonth() + 1;
                            var day = data.getDate();
                            var hours = data.getHours();
                            var Minutes = data.getMinutes();
                            var Seconds = data.getSeconds();
                            sjObj.opt.yyyy = fillZero(year);
                            sjObj.opt.mm = fillZero(month);
                            sjObj.opt.dd = fillZero(day);
                            sjObj.opt.h = fillZero(hours);
                            sjObj.opt.m = fillZero(Minutes);
                            sjObj.opt.s = fillZero(Seconds);
                            console.log(year, month, day, hours, Minutes);
                            console.log("是否显示年", sjObj.opt.Year)
                            if (sjObj.opt.Year) sjObj.opt.timeElm.find("[data-class='yyyy'] .df-li").each(function () {
                                console.log(parseInt($(this).attr("data-val")), parseInt(year))
                                if (parseInt($(this).attr("data-val")) == parseInt(year)) {
                                    var pY = -($(this).index() - 2) * sjObj.opt.height;
                                    console.log(pY, year)
                                    $(this).parent().css({"transform": "translate(0," + pY + "px)"})
                                }
                            })
                            if (sjObj.opt.Month) sjObj.opt.timeElm.find("[data-class='mm'] .df-li").each(function () {
                                if (parseInt($(this).attr("data-val")) == parseInt(month)) {
                                    var pY = -($(this).index() - 2) * sjObj.opt.height;
                                    console.log(pY, month)
                                    $(this).parent().css({"transform": "translate(0," + pY + "px)"})
                                }
                            })
                            if (sjObj.opt.Day) sjObj.opt.timeElm.find("[data-class='dd'] .df-li").each(function () {
                                if (parseInt($(this).attr("data-val")) == parseInt(day)) {
                                    var pY = -($(this).index() - 2) * sjObj.opt.height;
                                    console.log(day)
                                    $(this).parent().css({"transform": "translate(0," + pY + "px)"})
                                }
                            })
                            if (sjObj.opt.Hour) sjObj.opt.timeElm.find("[data-class='h'] .df-li").each(function () {
                                if (parseInt($(this).attr("data-val")) == parseInt(hours)) {
                                    var pY = -($(this).index() - 2) * sjObj.opt.height;
                                    $(this).parent().css({"transform": "translate(0," + pY + "px)"})
                                }
                            })
                            if (sjObj.opt.Minute) sjObj.opt.timeElm.find("[data-class='m'] .df-li").each(function () {
                                if (parseInt($(this).attr("data-val")) == parseInt(Minutes)) {
                                    var pY = -($(this).index() - 2) * sjObj.opt.height;
                                    console.log(pY, Minutes, $(this).index(), this)
                                    $(this).parent().css({"transform": "translate(0," + pY + "px)"})
                                }
                            })
                            if (sjObj.opt.Seconds) sjObj.opt.timeElm.find("[data-class='m'] .df-li").each(function () {
                                if (parseInt($(this).attr("data-val")) == parseInt(Seconds)) {
                                    var pY = -($(this).index() - 2) * sjObj.opt.height;
                                    $(this).parent().css({"transform": "translate(0," + pY + "px)"})
                                }
                            })
                        } else {
                            // console.log("使用自定义时间")
                            if (sjObj.opt.Year) sjObj.opt.timeElm.find("[data-class='yyyy'] .df-li").each(function () {
                                if (parseInt($(this).attr("data-val")) == parseInt(sjObj.opt.yyyy)) {
                                    var pY = -($(this).index() - 2) * sjObj.opt.height;
                                    $(this).parent().css({"transform": "translate(0," + pY + "px)"})
                                }
                            })
                            if (sjObj.opt.Month) sjObj.opt.timeElm.find("[data-class='mm'] .df-li").each(function () {
                                if (parseInt($(this).attr("data-val")) == parseInt(sjObj.opt.mm)) {
                                    var pY = -($(this).index() - 2) * sjObj.opt.height;
                                    $(this).parent().css({"transform": "translate(0," + pY + "px)"})
                                }
                            })
                            if (sjObj.opt.Day) sjObj.opt.timeElm.find("[data-class='dd'] .df-li").each(function () {
                                if (parseInt($(this).attr("data-val")) == parseInt(sjObj.opt.dd)) {
                                    var pY = -($(this).index() - 2) * sjObj.opt.height;
                                    $(this).parent().css({"transform": "translate(0," + pY + "px)"})
                                }
                            })
                            if (sjObj.opt.Hour) sjObj.opt.timeElm.find("[data-class='h'] .df-li").each(function () {
                                if (parseInt($(this).attr("data-val")) == parseInt(sjObj.opt.h)) {
                                    var pY = -($(this).index() - 2) * sjObj.opt.height;
                                    // console.log(pY, sjObj.opt.h, $(this).index())
                                    $(this).parent().css({"transform": "translate(0," + pY + "px)"})
                                }
                            })
                            if (sjObj.opt.Minute) sjObj.opt.timeElm.find("[data-class='m'] .df-li").each(function () {
                                if (parseInt($(this).attr("data-val")) == parseInt(sjObj.opt.m)) {
                                    var pY = -($(this).index() - 2) * sjObj.opt.height;
                                    console.log(pY, sjObj.opt.m, $(this).index())
                                    $(this).parent().css({"transform": "translate(0," + pY + "px)"})
                                }
                            })
                            if (sjObj.opt.Seconds) sjObj.opt.timeElm.find("[data-class='m'] .df-li").each(function () {
                                if (parseInt($(this).attr("data-val")) == parseInt(sjObj.opt.s)) {
                                    var pY = -($(this).index() - 2) * sjObj.opt.height;
                                    $(this).parent().css({"transform": "translate(0," + pY + "px)"})
                                }
                            })
                            // console.log("设置默认时间")
                        }
                        sjObj.opt.fillData();
                        sjObj.opt.setCenter();
                        sjObj.opt.bindFun();
                    },
                    bindFun: function () {
                        sjObj.opt.timeElm.find(".df-no").on("click", function () {
                            $(this).parent().parent().parent().remove();
                            sjObj.opt.onfun(sjObj);
                            $("html").removeClass("ov_hi");
                        })
                        sjObj.opt.timeElm.find(".df-ok").on("click", function () {
                            var str = "";
                            if (sjObj.opt.Year) {
                                str = sjObj.opt.Format.replace("yyyy", sjObj.opt.yyyy)
                            }
                            if (sjObj.opt.Month) {
                                str = str.replace("mm", sjObj.opt.mm);
                            }
                            if (sjObj.opt.Day) {
                                str = str.replace("dd", sjObj.opt.dd)
                            }
                            if (sjObj.opt.Day && sjObj.opt.Hour) {
                                str += " ";
                            }
                            if (sjObj.opt.Hour) {
                                str += sjObj.opt.h
                            }
                            if (sjObj.opt.Minute && sjObj.opt.Hour) {
                                str += ":"
                            }
                            if (sjObj.opt.Minute) {
                                str += sjObj.opt.m;
                            }
                            if (sjObj.opt.Minute && sjObj.opt.Seconds) {
                                str += ":"
                            }
                            if (sjObj.opt.Seconds) {
                                str += sjObj.opt.s;
                            }
                            sjObj.opt.val = sjObj.opt.isparseInt ? parseInt(str) : str;
                            console.log("我执行了没")
                            $(sjObj.opt.thisElm).val(sjObj.opt.val);
                            $(this).parent().parent().parent().remove();
                            sjObj.opt.okfun(sjObj);
                            $("html").removeClass("ov_hi");
                        })
                        sjObj.opt.moveElm(sjObj.opt.timeElm.find(".G-bg"))
                    },
                    fillData: function () {
                        var str = "";
                        if (sjObj.opt.Year) {
                            str += sjObj.opt.yyyy + '-';
                        }
                        if (sjObj.opt.Month) {
                            str += sjObj.opt.mm + '-'
                        }
                        if (sjObj.opt.Day) {
                            str += sjObj.opt.dd + "  "
                        }
                        if (sjObj.opt.Hour) {
                            str += sjObj.opt.h + ":00 - ";
                        }
                        if (sjObj.opt.Hour) {
                            str += sjObj.opt.h2 + ":00";
                        }
                        if (sjObj.opt.Minute) {
                            str += sjObj.opt.m;
                        }
                        if (sjObj.opt.Seconds) {
                            str += sjObj.opt.s;
                        }
                        if (!sjObj.opt.alwaysShow) {
                            console.log("直接显示?", sjObj.opt.timeElm.find(".df-final"));
                            if (sjObj.opt.isparseInt) {
                                sjObj.opt.timeElm.find(".df-final").html(parseInt(str));
                            } else {
                                sjObj.opt.timeElm.find(".df-final").html(str);
                            }
                        } else {
                            // console.log("啊哈哈哈哈啊?", sjObj.opt.timeElm.find(".df-final"))
                            $(sjObj.opt.thisElm).html(str).val(str);
                        }
                    },
                    vardata: function (name, val) {
                        if (!val) {
                            return;
                        }
                        if (sjObj.opt[name] != val) {
                            sjObj.opt[name] = val;
                            sjObj.opt.fillData();
                        }
                    },
                    getFinal: function () {
                        var currentY = 0;
                        var str = "";
                        if (sjObj.opt.showNowTime) {
                            sjObj.opt.timeElm.find(".df-ul").each(function () {
                                currentY = getTranslateY(this);
                                var dataClass = $(this).attr("data-class");
                                var val = $($(this).find(".df-li")[Math.round(currentY / sjObj.opt.height) + 2]).attr("data-val");
                                sjObj.opt.vardata(dataClass, val);
                                console.log(dataClass, val)
                                $(this).unbind("webkitTransitionEnd").on("webkitTransitionEnd", function () {
                                    currentY = getTranslateY(this);
                                    var val = $($(this).find(".df-li")[Math.round(currentY / sjObj.opt.height) + 2]).attr("data-val");
                                    dataClass = $(this).attr("data-class");
                                    sjObj.opt.vardata(dataClass, val);
                                    sjObj.opt.daysJudge(dataClass);
                                })
                            })
                        } else {
                            sjObj.opt.timeElm.find(".df-ul").each(function () {
                                currentY = getTranslateY(this);
                                var dataClass = $(this).attr("data-class");
                                var val = $($(this).find(".df-li")[Math.round(currentY / sjObj.opt.height) + 2]).attr("data-val");
                                sjObj.opt.vardata(dataClass, val);
                                // console.log(dataClass, val)
                                $(this).unbind("webkitTransitionEnd").on("webkitTransitionEnd", function () {
                                    currentY = getTranslateY(this);
                                    var val = $($(this).find(".df-li")[Math.round(currentY / sjObj.opt.height) + 2]).attr("data-val");
                                    dataClass = $(this).attr("data-class");
                                    sjObj.opt.vardata(dataClass, val);
                                    sjObj.opt.daysJudge(dataClass);
                                })
                            })
                        }
                    },
                    daysJudge: function (name) {
                        if (name == 'mm' || name == "yyyy") {
                            var day = new Date(sjObj.opt.yyyy, sjObj.opt.mm, 0).getDate();
                            var l = sjObj.opt.timeElm.find('[data-class="dd"]').find(".df-show").length
    
                            var mubiao = day - l;
                            // 增加
                            if (mubiao > 0) {
                                for (var i = 0; i < mubiao; i++) {
                                    $(sjObj.opt.timeElm.find('[data-class="dd"]').find(".df-li")[l + i]).removeClass("df-hide").addClass("df-show")
                                }
                            } else {
                                // 减少
                                var naomovey = getTranslateY(sjObj.opt.timeElm.find('[data-class="dd"]'))
                                for (var i = 0; i > mubiao; i--) {
                                    $(sjObj.opt.timeElm.find('[data-class="dd"]').find(".df-li")[l - 1 + i]).removeClass("df-show").addClass("df-hide")
                                }
                                if (naomovey > (day - 1 - 2) * sjObj.opt.height) {
                                    sjObj.opt.timeElm.find('[data-class="dd"]').css({"transition": "all .5s"})
                                    sjObj.opt.timeElm.find('[data-class="dd"]').css({"transform": "translate(0," + -(day - 1 - 2) * sjObj.opt.height + "px)"})
                                }
                            }
                            // 自定义的 起始月事件
                            sjObj.opt.setstartMont(name);
                            // 自定义的 结束月事件
                            sjObj.opt.setendMont(name);
                        };
                        // 自定义的起始天
                        sjObj.opt.setstartDay(name);
                        // 自定义的结束天
                        sjObj.opt.setendDay(name);
                    },
                    // 自定义的 起始月事件
                    setstartMont:function(name){
                        if(name=='yyyy'){
                            if(sjObj.opt.yyyy==sjObj.opt.startYear){
                                var naomovey_mm = getTranslateY(sjObj.opt.timeElm.find('[data-class="mm"]'))
    
                                for (var i = 0; i < 11; i++) {
                                    $(sjObj.opt.timeElm.find('[data-class="mm"]').find(".df-li")[i]).removeClass("df-hide").addClass("df-show")
                                }
                                for (var i = 0; i < sjObj.opt.startMonh-1; i++) {
                                    $(sjObj.opt.timeElm.find('[data-class="mm"]').find(".df-li")[i]).removeClass("df-show").addClass("df-hide");
                                }
    
                                if ( naomovey_mm<= (sjObj.opt.startMonh-3)* sjObj.opt.height ) {
                                    sjObj.opt.timeElm.find('[data-class="mm"]').css({"transition": "all .5s"})
                                    sjObj.opt.timeElm.find('[data-class="mm"]').css({"transform": "translate(0," + -(sjObj.opt.startMonh-3)* sjObj.opt.height + "px)"})
                                }
                            }else{
                                if(sjObj.opt.yyyy!=sjObj.opt.endYear) {
                                    for (var i = 0; i < 11; i++) {
                                        $(sjObj.opt.timeElm.find('[data-class="mm"]').find(".df-li")[i]).removeClass("df-hide").addClass("df-show")
                                    }
                                }
                            }
                        }
                        if(name=='mm'){
                            if(sjObj.opt.yyyy==sjObj.opt.startYear){
                                var naomovey_mm = getTranslateY(sjObj.opt.timeElm.find('[data-class="mm"]'))
                                // console.log(naomovey_mm+'xxxxxxxxxxxxxx')
                                if ( naomovey_mm<= (sjObj.opt.startMonh-3)* sjObj.opt.height ) {
                                    sjObj.opt.timeElm.find('[data-class="mm"]').css({"transition": "all .5s"})
                                    sjObj.opt.timeElm.find('[data-class="mm"]').css({"transform": "translate(0," + -(sjObj.opt.startMonh-3)* sjObj.opt.height + "px)"})
                                }
                            }
                        }
                    },
                    // 自定义的起始天
                    setstartDay:function(name){
                        if(name=='mm'||name=='yyyy'){
                            if(sjObj.opt.yyyy==sjObj.opt.startYear&&sjObj.opt.mm==sjObj.opt.startMonh){
                                var naomovey_dd = getTranslateY(sjObj.opt.timeElm.find('[data-class="dd"]'))
    
                                for (var i = 0; i < sjObj.opt.startDay-1; i++) {
                                    $(sjObj.opt.timeElm.find('[data-class="dd"]').find(".df-li")[i]).removeClass("df-show").addClass("df-hide");
                                }
    
                                if ( naomovey_dd<= (sjObj.opt.startDay-3)* sjObj.opt.height ) {
                                    sjObj.opt.timeElm.find('[data-class="dd"]').css({"transition": "all .5s"})
                                    sjObj.opt.timeElm.find('[data-class="dd"]').css({"transform": "translate(0," + -(sjObj.opt.startDay-3)* sjObj.opt.height + "px)"})
                                }
                            }else {
                                if(sjObj.opt.yyyy!=sjObj.opt.endYear&&sjObj.opt.mm!=sjObj.opt.endMonh){
                                    var cdays = new Date(sjObj.opt.yyyy, sjObj.opt.mm, 0).getDate();
                                    for (var i = 0; i < cdays; i++) {
                                        $(sjObj.opt.timeElm.find('[data-class="dd"]').find(".df-li")[i]).removeClass("df-hide").addClass("df-show")
                                    }
                                }
                            }
                        }
                        if(name=='dd'){
                            if(sjObj.opt.yyyy==sjObj.opt.startYear&&sjObj.opt.mm==sjObj.opt.startMonh){
                                var naomovey_dd = getTranslateY(sjObj.opt.timeElm.find('[data-class="dd"]'))
                                // console.log(naomovey_dd+'xxxxxxxxxxxxxx')
                                if ( naomovey_dd<= (sjObj.opt.startDay-3)* sjObj.opt.height ) {
                                    sjObj.opt.timeElm.find('[data-class="dd"]').css({"transition": "all .5s"})
                                    sjObj.opt.timeElm.find('[data-class="dd"]').css({"transform": "translate(0," + -(sjObj.opt.startDay-3)* sjObj.opt.height + "px)"})
                                }
                            }
                        }
    
                    },
                    // 自定义的 结束月事件
                    setendMont:function(name){
                        if(name=='yyyy'){
                            if(sjObj.opt.yyyy==sjObj.opt.endYear){
                                var naomovey_mmend = getTranslateY(sjObj.opt.timeElm.find('[data-class="mm"]'))
    
                                for (var i = 0; i < 11; i++) {
                                    $(sjObj.opt.timeElm.find('[data-class="mm"]').find(".df-li")[i]).removeClass("df-hide").addClass("df-show")
                                }
                                for (var i = parseFloat(sjObj.opt.endMonh); i < 11; i++) {
                                    $(sjObj.opt.timeElm.find('[data-class="mm"]').find(".df-li")[i]).removeClass("df-show").addClass("df-hide");
                                }
                                if ( naomovey_mmend> (sjObj.opt.endMonh-3)* sjObj.opt.height ) {
                                    sjObj.opt.timeElm.find('[data-class="mm"]').css({"transition": "all .5s"})
                                    sjObj.opt.timeElm.find('[data-class="mm"]').css({"transform": "translate(0," + -(sjObj.opt.endMonh-3)* sjObj.opt.height + "px)"})
                                }
                            }else{
                                if(sjObj.opt.yyyy!=sjObj.opt.startYear){
                                    for (var i = 0; i < 11; i++) {
                                        $(sjObj.opt.timeElm.find('[data-class="mm"]').find(".df-li")[i]).removeClass("df-hide").addClass("df-show")
                                    }
                                }
                            }
                        }
                        if(name=='mm'){
                            if(sjObj.opt.yyyy==sjObj.opt.endYear){
                                var naomovey_mmend = getTranslateY(sjObj.opt.timeElm.find('[data-class="mm"]'))
                                console.log(naomovey_mmend+'xxxxxxxxxxxxxx')
                                if ( naomovey_mmend> (sjObj.opt.endMonh-3)* sjObj.opt.height ) {
                                    sjObj.opt.timeElm.find('[data-class="mm"]').css({"transition": "all .5s"})
                                    sjObj.opt.timeElm.find('[data-class="mm"]').css({"transform": "translate(0," + -(sjObj.opt.endMonh-3)* sjObj.opt.height + "px)"})
                                }
                            }
                        }
                    },
                    // 自定义的结束天
                    setendDay:function(name){
                        if(name=='mm'||name=='yyyy'){
                            // console.log(sjObj.opt.mm)
                            if(sjObj.opt.yyyy==sjObj.opt.endYear&&sjObj.opt.mm==parseFloat(sjObj.opt.endMonh)){
                                var naomovey_dd_day = getTranslateY(sjObj.opt.timeElm.find('[data-class="dd"]'))
                                for (var i = 0; i < 31; i++) {
                                    $(sjObj.opt.timeElm.find('[data-class="dd"]').find(".df-li")[i]).removeClass("df-hide").addClass("df-show");
                                }
                                for (var i = parseFloat(sjObj.opt.endDay); i < 31; i++) {
                                    $(sjObj.opt.timeElm.find('[data-class="dd"]').find(".df-li")[i]).removeClass("df-show").addClass("df-hide");
                                }
    
                                if ( naomovey_dd_day>= (sjObj.opt.endDay-3)* sjObj.opt.height ) {
                                    sjObj.opt.timeElm.find('[data-class="dd"]').css({"transition": "all .5s"})
                                    sjObj.opt.timeElm.find('[data-class="dd"]').css({"transform": "translate(0," + -(sjObj.opt.endDay-3)* sjObj.opt.height + "px)"})
                                }
                            }else {
                                if(sjObj.opt.yyyy!=sjObj.opt.startYear&&sjObj.opt.mm!=sjObj.opt.startMonh) {
                                    var cdays = new Date(sjObj.opt.yyyy, sjObj.opt.mm, 0).getDate();
                                    for (var i = 0; i < cdays; i++) {
                                        $(sjObj.opt.timeElm.find('[data-class="dd"]').find(".df-li")[i]).removeClass("df-hide").addClass("df-show")
                                    }
                                }
                            }
                        }
                        if(name=='dd'){
                            if(sjObj.opt.yyyy==sjObj.opt.endYear&&sjObj.opt.mm==sjObj.opt.endMonh){
                                var naomovey_dd_day = getTranslateY(sjObj.opt.timeElm.find('[data-class="dd"]'))
                                // console.log(naomovey_dd_day+'xxxxxxxxxxxxxx')
                                if ( naomovey_dd_day>= (sjObj.opt.endDay-3)* sjObj.opt.height ) {
                                    sjObj.opt.timeElm.find('[data-class="dd"]').css({"transition": "all .5s"})
                                    sjObj.opt.timeElm.find('[data-class="dd"]').css({"transform": "translate(0," + -(sjObj.opt.endDay-3)* sjObj.opt.height + "px)"})
                                }
                            }
                        }
    
                    },
                    moveElm: function (eml) {
                        var classNameyyy=$(eml[0].offsetParent).find('ul').attr('data-class');
                        var classNamemm=$(eml[1].offsetParent).find('ul').attr('data-class');
                        var classNamedd=$(eml[2].offsetParent).find('ul').attr('data-class');
                        return $(eml).each(function () {
                            var sX = null, sY = null, mX = null, mY = null, eX = null, eY = null, sTime = null,
                                eTime = null, mTime = null, nTime = null, nY = 0, drt = null, nowElm = null,
                                canStart = true, canMove = false, canEnd = false, emlLang = null, maxY = null, minY = null,
                                lastY = null, nowY = null, moveY = null, stopInertiaMove = false, SE = null, ME = null,
                                EE = null, moveCy = 0;
                            var stop = function (e) {
                                if (e.preventDefault)
                                    e.preventDefault();
                                e.returnValue = false;
                            }
                            var moveStart = function (e) {
                                // console.log(e);
                                stop(e);
                                if (!canStart) {
                                    return
                                }
                                if (e.originalEvent.touches) {
                                    SE = e.originalEvent.targetTouches[0]
                                } else {
                                    SE = e;
                                }
                                sX = SE.pageX;
                                sY = SE.pageY;
                                nowElm = $(this).prev(".df-ul");
                                emlLang = nowElm.find(".df-show").length;
                                lastY = sY;
                                nY = getTranslateY(nowElm);
                                // console.log("移动开始时", e,nY);
                                sTime = new Date().getTime();
                                if (!canMove && canEnd) {
                                    return false
                                }
                                canStart = false
                                canMove = false;
                                stopInertiaMove = true;
                                $(window).on("touchmove", function (e) {
                                    if (stopInertiaMove) {
                                        e.preventDefault();
                                    }
                                })
                            };
                            var moveing = function (e) {
                                stop(e);
                                if (e.originalEvent.touches) {
                                    ME = e.originalEvent.targetTouches[0]
                                } else {
                                    ME = e;
                                }
                                mTime = new Date().getTime();
                                mX = ME.pageX;
                                mY = ME.pageY;
                                drt = GetSlideDirection(sX, sY, mX, mY);
                                if ((drt == 1 || drt == 2) && !canStart) {
                                    canMove = true;
                                    canEnd = true;
                                    stopInertiaMove = true;
                                }
                                if (canMove) {
                                    nowElm.css({"transition": "none"})
                                    nowElm.css({"transform": "translate(0," + -(nY - (mY - sY)) + "px)"})
                                    sjObj.opt.getFinal();
                                }
                                if (mTime - sTime > 300) {
                                    // console.log("移动后加速")
                                    sTime = mTime;
                                    lastY = mY;
                                }
                            };
                            var moveEnd = function (e) {
                                stop(e);
                                // 我们根据 event事件 找到滑动的 是 年还是月 还是日
                                // console.log($(e.currentTarget).siblings('.df-ul').attr('data-class'))
                                var etarget=$(e.currentTarget).siblings('.df-ul').attr('data-class');
                                if (e.originalEvent.touches) {
                                    EE = e.originalEvent.changedTouches[0]
                                } else {
                                    EE = e;
                                }
                                eX = EE.pageX;
                                eY = EE.pageY;
                                maxY = sjObj.opt.height * 2;
                                // minY = -(emlLang - 3) * sjObj.opt.height;
                                // 1dian 这里是控制最大下拉距离的
                                if(sjObj.opt.yyyy==sjObj.opt.startYear&&etarget=='mm'){
                                    minY = -(12 - 3) * sjObj.opt.height;
                                } else if(sjObj.opt.yyyy==sjObj.opt.startYear&&sjObj.opt.mm==sjObj.opt.startMonh&&etarget=='dd'){
                                    var cday = new Date(sjObj.opt.yyyy, sjObj.opt.startMonh, 0).getDate();
                                    minY = -(cday - 3) * sjObj.opt.height;
                                }
                                else if(sjObj.opt.yyyy==sjObj.opt.endYear&&etarget=='mm'){
                                    minY = -(sjObj.opt.endMonh-3)* sjObj.opt.height;
                                }
                                else if(sjObj.opt.yyyy==sjObj.opt.endYear&&sjObj.opt.mm==sjObj.opt.endMonh&&etarget=='dd'){
                                    var cday = new Date(sjObj.opt.yyyy, sjObj.opt.endMonh, 0).getDate();
                                    minY = -(cday - 3) * sjObj.opt.height;
                                }else{
                                    minY = -(emlLang - 3) * sjObj.opt.height;
                                }
                                if (canEnd) {
    
                                    canMove = false;
                                    canEnd = false;
                                    canStart = true;
                                    nY = -(nY - (mY - sY));
                                    nowY = eY;
    
                                    if (nY > maxY) {
                                        nowElm.css({"transition": "all .5s"})
                                        nowElm.css({"transform": "translate(0," + maxY + "px)"})
                                    } else if (nY < minY) {
                                        nowElm.css({"transition": "all .5s"})
                                        nowElm.css({"transform": "translate(0," + minY + "px)"})
                                        return ;
                                    } else {
                                        eTime = new Date().getTime();
                                        var speed = ((nowY - lastY) / (eTime - sTime));
                                        stopInertiaMove = false;
                                        (function (v, startTime, contentY) {
                                            // contentY 滑动的距离
                                            // dir -1往上滑
                                            // dir 1往下滑
                                            var dir = v > 0 ? -1 : 1;
                                            var deceleration = dir * 0.001;
    
                                            function inertiaMove() {
                                                if (stopInertiaMove)
                                                    return;
                                                var nowTime = new Date().getTime();
                                                // t 是时间差
                                                var t = nowTime - startTime;
                                                // nowY 是现在的速度
                                                var nowV = v + t * deceleration;
                                                // 移动的距离  sudu
                                                var moveY = (v + nowV) / 2 * t;
                                                if (dir * nowV > 0) {
                                                // console.log(moveCy,minY,sjObj.opt.minY)
                                                    if (moveCy > sjObj.opt.maxY) {
                                                        console.log('moveCy大于'+moveCy)
                                                        nowElm.css({"transition": "all .5s"})
                                                        sjObj.opt.nowElm.css({"transform": "translate(0," + sjObj.opt.maxY + "px)"})
                                                    } else if (moveCy < sjObj.opt.minY) {
                                                        console.log('moveCy小于'+moveCy)
                                                        nowElm.css({"transition": "all .5s"})
                                                        nowElm.css({"transform": "translate(0," + sjObj.opt.minY + "px)"})
                                                    } else {
                                                        var MC = Math.round(moveCy / sjObj.opt.height)
                                                        // console.log('MC:'+MC)
                                                        // 2dian 这里是第二个关键点
                                                        if(sjObj.opt.yyyy==sjObj.opt.startYear&&etarget=='mm'){
                                                            if (MC > 2) {
                                                                MC = 2
                                                            } else if (MC < -(12 - 1) + 2) {
                                                                MC = -(12 - 1) + 2
                                                            }
                                                            // console.log('mm+,'+MC)
                                                        }else if(sjObj.opt.yyyy==sjObj.opt.endYear&&etarget=='mm'){
    
                                                            if (MC > 2) {
                                                                MC = 2
                                                            } else if (MC < -sjObj.opt.endMonh) {
                                                                MC = -(sjObj.opt.endMonh-3)
                                                            }
                                                            console.log('endmonth:'+MC)
                                                        }
                                                        else if(sjObj.opt.yyyy==sjObj.opt.startYear&&sjObj.opt.mm==sjObj.opt.startMonh&&etarget=='dd'){
                                                            var cday = new Date(sjObj.opt.yyyy, sjObj.opt.startMonh, 0).getDate();
                                                            if (MC > 2) {
                                                                MC = 2
                                                            } else if (MC < -(cday-1 ) + 2) {
                                                                MC = -(cday-1) + 2
                                                            }
                                                            // console.log('dd:'+MC,cday)
                                                        }
                                                        else if(sjObj.opt.yyyy==sjObj.opt.endYear&&sjObj.opt.mm==sjObj.opt.endtMonh&&etarget=='dd'){
                                                            var cday = new Date(sjObj.opt.yyyy, sjObj.opt.endMonh, 0).getDate();
                                                            if (MC > 2) {
                                                                MC = 2
                                                            } else if (MC < -(cday-1 ) + 2) {
                                                                MC = -(cday-1) + 2
                                                            }
                                                            console.log('eeenddd:'+MC,cday)
                                                        }
                                                        else{
                                                            if (MC > 2) {
                                                                MC = 2
                                                            } else if (MC < -(emlLang - 1) + 2) {
                                                                MC = -(emlLang - 1) + 2
                                                            }
                                                            // console.log('else:'+MC,cday)
                                                        }
                                                        console.log('reslut:'+MC)
                                                        nowElm.css({"transition": "all .4s"});
                                                        nowElm.css({"transform": "translate(0," + sjObj.opt.height * MC + "px)"})
                                                    }
                                                    sjObj.opt.getFinal();
                                                    return
                                                }
                                                moveCy = (contentY + moveY)
                                                // console.log('moveCy'+moveCy)
                                                if (moveCy > (maxY + (sjObj.opt.height * 2))) {
                                                    nowElm.css({"transition": "all .5s"})
                                                    nowElm.css({"transform": "translate(0," + maxY + "px)"})
                                                    return
                                                } else if (moveCy < (minY - (sjObj.opt.height * 2))) {
                                                    nowElm.css({"transition": "all .5s"})
                                                    nowElm.css({"transform": "translate(0," + minY + "px)"})
                                                    return
                                                }
                                                nowElm.css({"transform": "translate(0," + moveCy + "px)"})
                                                sjObj.opt.getFinal();
                                                var timers = setTimeout(inertiaMove, 10);
                                            }
    
                                            inertiaMove();
    
                                        })(speed, eTime, nY);
                                    }
                                    // console.log("移动结束", EE)
                                }
                            }
                            // console.log("开始绑定事件", $(this))
                            $(this).unbind("touchstart mousedown").on("touchstart mousedown", moveStart)
                            $(this).unbind("touchmove").on("touchmove", moveing)
                            $(this).unbind("touchend").on("touchend", moveEnd)
                            $(document).on("mousemove", moveing)
                            $(document).on("mouseup", moveEnd)
                        })
                    },
                };
                sjObj.opt = $.extend({}, sjObj.defaults, opt);
                var GetSlideAngle = function (dx, dy) {
                    return Math.atan2(dy, dx) * 180 / Math.PI;
                };
    
                function getnyrstr(str) {
                    var r = sjObj.opt.Format;
                    var valarr = str.split("-");
                    console.log(valarr, str);
                    if (valarr.length == 3) {
                        r = r.replace("yyyy", valarr[0]);
                        r = r.replace("mm", valarr[1]);
                        r = r.replace("dd", valarr[2]);
                    } else if (valarr.length == 2) {
                        if (sjObj.opt.Year && !sjObj.opt.Month) {
                            r = r.replace("yyyy", valarr[0]);
                            r = r.replace("mm", sjObj.opt.mm);
                            r = r.replace("dd", valarr[1]);
                        } else if (sjObj.opt.Year && !sjObj.opt.Day) {
                            r = r.replace("yyyy", valarr[0]);
                            r = r.replace("mm", valarr[1]);
                            r = r.replace("dd", sjObj.opt.dd);
                        } else if (!sjObj.opt.Year) {
                            r = r.replace("yyyy", sjObj.opt.yyyy);
                            r = r.replace("mm", valarr[0]);
                            r = r.replace("dd", valarr[1]);
                        }
                    } else if (valarr.length == 1) {
                        if (sjObj.opt.Year) {
                            r = r.replace("yyyy", valarr[0]);
                            r = r.replace("mm", sjObj.opt.mm);
                            r = r.replace("dd", sjObj.opt.dd);
                        } else if (sjObj.opt.Month) {
                            r = r.replace("yyyy", sjObj.opt.yyyy);
                            r = r.replace("mm", valarr[0]);
                            r = r.replace("dd", sjObj.opt.dd);
                        } else if (sjObj.opt.Day) {
                            r = r.replace("yyyy", sjObj.opt.yyyy);
                            r = r.replace("mm", sjObj.opt.mm);
                            r = r.replace("dd", valarr[0]);
                        } else {
                            r = r.replace("yyyy", sjObj.opt.yyyy);
                            r = r.replace("mm", sjObj.opt.mm);
                            r = r.replace("dd", sjObj.opt.dd);
                        }
                    }
                    ;console.log("返回年月日", r);
                    return r;
                }
    
                function getsfmstr(str) {
                    var r = sjObj.opt.timeFormat;
                    console.log(r);
                    var valarr = str.split(":");
                    if (valarr.length == 3) {
                        r = r.replace("h", valarr[0]);
                        r = r.replace("m", valarr[1]);
                        r = r.replace("s", valarr[2]);
                    } else if (valarr.length == 2) {
                        if (sjObj.opt.Hour && !sjObj.opt.Minute) {
                            r = r.replace("h", valarr[0]);
                            r = r.replace("m", sjObj.opt.m);
                            r = r.replace("s", valarr[1]);
                        } else if (sjObj.opt.Hour && !sjObj.opt.Seconds) {
                            r = r.replace("h", valarr[0]);
                            r = r.replace("m", valarr[1]);
                            r = r.replace("s", sjObj.opt.s);
                        } else if (!sjObj.opt.Hour) {
                            r = r.replace("h", sjObj.opt.h);
                            r = r.replace("m", valarr[0]);
                            r = r.replace("s", valarr[1]);
                        }
                    } else if (valarr.length == 1) {
                        if (sjObj.opt.Hour) {
                            r = r.replace("h", valarr[0]);
                            r = r.replace("m", sjObj.opt.m);
                            r = r.replace("s", sjObj.opt.s);
                        } else if (sjObj.opt.Minute) {
                            r = r.replace("h", sjObj.opt.h);
                            r = r.replace("m", valarr[0]);
                            r = r.replace("s", sjObj.opt.s);
                        } else if (sjObj.opt.Hour) {
                            r = r.replace("h", sjObj.opt.h);
                            r = r.replace("m", sjObj.opt.m);
                            r = r.replace("s", valarr[0]);
                        } else {
                            r = r.replace("h", sjObj.opt.h);
                            r = r.replace("m", sjObj.opt.m);
                            r = r.replace("s", sjObj.opt.s);
                        }
                    }
                    ;console.log("返回时分秒", r);
                    return r;
                }
    
                var GetSlideDirection = function (startX, startY, endX, endY) {
                    var dy = startY - endY;
                    var dx = endX - startX;
                    var result = 0;
                    if (Math.abs(dx) < 2 && Math.abs(dy) < 2) {
                        return result;
                    }
                    var angle = GetSlideAngle(dx, dy);
                    if (angle >= -45 && angle < 45) {
                        result = 4;
                    } else if (angle >= 45 && angle < 135) {
                        result = 1;
                    } else if (angle >= -135 && angle < -45) {
                        result = 2;
                    }
                    else if ((angle >= 135 && angle <= 180) || (angle >= -180 && angle < -135)) {
                        result = 3;
                    }
                    return result;
                };
                var getTranslateY = function (eml) {
                    var matrix = $(eml).css("transform");
                    // console.log("获取到的transform", matrix)
                    var T;
                    if (matrix == "none") {
                        T = 0;
                    } else {
                        var arr = matrix.split(",")
                        T = -(arr[5].split(")")[0]);
                    }
                    // console.log("返回的transform", T)
                    return T
                }
                sjObj.innt = function () {
                    if (!sjObj.opt.alwaysShow) {
                        $(this).on("click", function (e) {
                            e.stopPropagation();
                            sjObj.opt.thisElm = this;
                            switch (sjObj.opt.type) {
                                case "time":
                                    $("html").addClass("ov_hi");
                                    $(this).blur();
                                    sjObj.opt.getYear();
                                    sjObj.opt.buildHTml();
                                    sjObj.opt.getFinal();
                                    break;
                            }
                        })
                    } else {
                        sjObj.opt.thisElm = this;
                        // console.log("直接显示")
                        sjObj.opt.getYear();
                        sjObj.opt.buildHTml();
                    }
                    $(window).on("resize", function () {
                        // console.log("窗口大小改变")
                        sjObj.opt.setCenter()
                    })
                }
                sjObj.innt();
                return sjObj
            }
    
            if (this.length > 1) {
                console.log("多个")
                var arr = []
                $.each(this, function () {
                    arr.push(cPlugin(this, true))
                })
                return arr
            } else {
                // console.log("一个")
                obj = cPlugin(this);
                // console.log("一个时间对象", obj);
                return obj
            }
        }
    })(jQuery)
    

      

  • 相关阅读:
    【BZOJ4033】【HAOI2015】树上染色
    【BZOJ1040】【ZJOI2008】骑士
    【BZOJ3573】【HNOI2014】米特运输
    【BZOJ1060】【ZJOI2007】时态同步
    17-10-11模拟赛
    17-10-05模拟赛
    17-09-29模拟赛
    17-09-21模拟赛
    17-09-20模拟赛
    17-09-15模拟赛
  • 原文地址:https://www.cnblogs.com/gaidalou/p/10998854.html
Copyright © 2020-2023  润新知