修改jquey-ui源码中的_showDatepicker方法,如下图:
修改完成以后进行代码压缩,压缩后的代码如下:
_showDatepicker:function(input){var u,flag,inst,beforeShow,beforeShowSettings,isFixed,offset,showAnim,duration,postProcess;if(input=input.target||input,"input"!=input.nodeName.toLowerCase()&&(input=$("input",input.parentNode)[0]),u=navigator.userAgent,u.indexOf("Trident")>-1){if(flag=!1,null===$.datepicker._lastInput&&(flag=!0),$.datepicker._isDisabledDatepicker(input)||$.datepicker._lastInput==input||flag)return null===$.datepicker._lastInput&&($.datepicker._lastInput=-1,flag=!0),void 0}else if($.datepicker._isDisabledDatepicker(input)||$.datepicker._lastInput==input)return;if(inst=$.datepicker._getInst(input),$.datepicker._curInst&&$.datepicker._curInst!=inst&&($.datepicker._curInst.dpDiv.stop(!0,!0),inst&&$.datepicker._datepickerShowing&&$.datepicker._hideDatepicker($.datepicker._curInst.input[0])),beforeShow=$.datepicker._get(inst,"beforeShow"),beforeShowSettings=beforeShow?beforeShow.apply(input,[input,inst]):{},beforeShowSettings===!1)return;extendRemove(inst.settings,beforeShowSettings),inst.lastVal=null,$.datepicker._lastInput=input,$.datepicker._setDateFromField(inst),$.datepicker._inDialog&&(input.value=""),$.datepicker._pos||($.datepicker._pos=$.datepicker._findPos(input),$.datepicker._pos[1]+=input.offsetHeight),isFixed=!1,$(input).parents().each(function(){return isFixed|="fixed"==$(this).css("position"),!isFixed}),offset={left:$.datepicker._pos[0],top:$.datepicker._pos[1]},$.datepicker._pos=null,inst.dpDiv.empty(),inst.dpDiv.css({position:"absolute",display:"block",top:"-1000px"}),$.datepicker._updateDatepicker(inst),offset=$.datepicker._checkOffset(inst,offset,isFixed),inst.dpDiv.css({position:$.datepicker._inDialog&&$.blockUI?"static":isFixed?"fixed":"absolute",display:"none",left:offset.left+"px",top:offset.top+"px"}),inst.inline||(showAnim=$.datepicker._get(inst,"showAnim"),duration=$.datepicker._get(inst,"duration"),postProcess=function(){var b,a=inst.dpDiv.find("iframe.ui-datepicker-cover");a.length&&(b=$.datepicker._getBorders(inst.dpDiv),a.css({left:-b[0],top:-b[1],width:inst.dpDiv.outerWidth(),height:inst.dpDiv.outerHeight()}))},inst.dpDiv.zIndex($(input).zIndex()+1),$.datepicker._datepickerShowing=!0,$.effects&&($.effects.effect[showAnim]||$.effects[showAnim])?inst.dpDiv.show(showAnim,$.datepicker._get(inst,"showOptions"),duration,postProcess):inst.dpDiv[showAnim||"show"](showAnim?duration:null,postProcess),showAnim&&duration||postProcess(),inst.input.is(":visible")&&!inst.input.is(":disabled")&&inst.input.focus(),$.datepicker._curInst=inst);}
替换原jquey-ui中的_showDatepicker方法。