jQuery datepicker causes page overflow

一世执手 提交于 2019-12-12 12:28:29

问题


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-index issue.

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


回答1:


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>');
}


来源:https://stackoverflow.com/questions/2692601/jquery-datepicker-causes-page-overflow

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