How to control positioning of jQueryUI datepicker

前端 未结 13 1283
一整个雨季
一整个雨季 2020-12-07 16:55

The datepicker in jQueryUI renders with a dynamic position. It renders according to its css if there\'s enough room for it, but if there isn\'t enough window space it tries

相关标签:
13条回答
  • 2020-12-07 17:32

    earlier i tried giving top, left in beforeShow event of datepicker.js, that's get override by _showDatePicker method of jquery-ui-custom.js . But after timeout the window its working fine. Below is the code

    beforeShow : function(input,inst) {
      var offset = js.select("#" + dpId).offset();
                            var height = js.select("#" + dpId).height();
                            var width = js.select("#" + dpId).width();
                            window.setTimeout(function () {
                                  js.select(inst.dpDiv).css({ top: (offset.top + height - 185) + 'px', left: (offset.left + width + 50) + 'px' })
                            }, 1);
    }
    
    0 讨论(0)
提交回复
热议问题