Jquery datePicker

╄→гoц情女王★ 提交于 2020-01-25 07:58:24

问题


I have slight issue with the jquery datepicker in that it displays ABOVE the target box. This is due to the way my page is set up. I found the issue with CSS in my page via firebug, unfortunately it conflicts with about 20 elements.

Next I tried hooking into the "beforeShow event" which works but then after the event fires it just recalculates and puts it where ever it wants.

 beforeShow: function() {
                $('#ui-datepicker-div').show();
                var offset = $('#ui-datepicker-div').offset();
                $('#ui-datepicker-div').css({
                    top: (offset.top + 222) + 'px'
                })
            }

Does anyone else have any ideas how how I can reposition this? I just need to move it down by about 200 odd pixels.


回答1:


Overriding the _showDatepicker function seems to work:

(function() {
var orig = jQuery.datepicker._showDatepicker;

jQuery.datepicker._showDatepicker = function(input){
    orig.apply(this, arguments);
    $('#ui-datepicker-div').css('top', '100px');
}
})();


来源:https://stackoverflow.com/questions/2488404/jquery-datepicker

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!