开发者

jQuery datepicker causes page overflow

开发者 https://www.devze.com 2022-12-28 00:48 出处:网络
I am using the datepicker control from jQuery-ui 1.8. from-date is a text input. I am attaching a very simple datepicker:

I am using the datepicker control from jQuery-ui 1.8. from-date is a text input. I am attaching a very simple datepicker:

$('#from-date').datepicker();

This causes the page to overflow (vertical scrollbar), which I am trying to avoid. As soon as I click the from-date, the datepicker control appears, and the scrollbar dissapears. After dismissing the datepicker, the scrollbar doesn't appear anymore.

The text field is inside a div that has overflow:auto and a fixed height and width. I suspect it's a z-i开发者_JS百科ndex issue.

What am I doing wrong ? How would I debug this ?


I had exactly the same problem. Wrapping Datepicker into a new div with a fixed position after the document is ready worked for me:

$(document).ready(function() {
    // ...
    $("#ui-datepicker-div").wrap('<div style="position:absolute;top:0px;"></div>');
}
0

精彩评论

暂无评论...
验证码 换一张
取 消