本文介绍了当日历中的周数增加时,jQuery datepicker会重叠输入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
JSFiddle DEMO
I have input with jQuery datepicker (that opens up on focus).
$( "#datepicker" ).datepicker()
when we choose another month, that have greater number of weeks, datepicker overlaps input.
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
解决方案
Here is the trick:
$(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');
}
});
So basically, this code will get the height of your datepicker
when you click the next
or previous
arrow and adjust the css top
value based on the calculated height.
这篇关于当日历中的周数增加时,jQuery datepicker会重叠输入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!