diff --git a/datepicker/datepicker.js b/datepicker/datepicker.js index defae44..31f14c9 100644 --- a/datepicker/datepicker.js +++ b/datepicker/datepicker.js @@ -1,3 +1,6 @@ +var lastselect = null; + + (function () { var utils = { addClass: function (target, className) { @@ -33,6 +36,7 @@ }); }, hide: function (target) { + this.attr(target, 'isShow', 'off'); this.css(target, { display: 'none' @@ -41,12 +45,12 @@ formatDate: function (num) { return num < 10 ? '0' + num : num; }, - fadeOut: function(target) { + fadeOut: function (target) { if (this.attr(target, 'isShow') == 'off') return; this.attr(target, 'isShow', 'off'); var opacity = 100; var _this = this; - target.timer = setInterval(function() { + target.timer = setInterval(function () { opacity -= opacity / 20; opacity < 80 && _this.css(target, { opacity: opacity / 100 @@ -58,7 +62,7 @@ opacity: 1 }) } - },10); + }, 10); }, }; @@ -84,13 +88,13 @@ this.init(); }; - Calendar.create = function(opt) { - for(var prop in opt){ + Calendar.create = function (opt) { + for (var prop in opt) { Calendar.Opt[prop] = opt[prop]; }; var elemArr = document.getElementsByClassName(Calendar.Opt.classN); - for(var i=0;i' + '' + '' + @@ -342,7 +368,7 @@ self.turnToToday(target); } }, false); - document.addEventListener('click', function() { + document.addEventListener('click', function () { utils.fadeOut(self.elem_wrap); }, false); // 点击遮罩隐藏