1

JSFiddle DEMO
I have input with jQuery datepicker (that opens up on focus).

$( "#datepicker" ).datepicker()

enter image description here
when we choose another month, that have greater number of weeks, datepicker overlaps input.

enter image description here
I can always open down datepicker, and this problem will be resolved, but it's not good solution.
Do you know another solution for this problem?

Thanks in advance

4

1 回答 1

1

这是诀窍:

$(document).on('click','.ui-datepicker-prev, .ui-datepicker-next',function(){
    var height = $('.ui-datepicker').height();
    if(height > 245) {
        $('.ui-datepicker').css('top','20px');
    } else {
        $('.ui-datepicker').css('top','50px');
    }
});

datepicker因此,基本上,当您单击nextprevious箭头并top根据计算出的高度调整 css 值时,此代码将获得您的高度。

小提琴

于 2013-04-21T14:12:11.903 回答