jQuery datepicker导致页面溢出 [英] jQuery datepicker causes page overflow
问题描述
我正在使用jQuery-ui 1.8中的datepicker控件。 from-date
是一个文本输入。我附加了一个非常简单的日期选择器:
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();
这导致页面溢出(垂直滚动条),我试图避免。单击from-date后,将出现datepicker控件,滚动条消失。在取消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.
文本字段位于具有overflow:auto和固定高度和宽度的div内。我怀疑这是一个z指数问题。
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 ?
推荐答案
我遇到了完全相同的问题。在文档准备就绪后,将Datepicker包装到具有固定位置的新div中:
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>');
}
这篇关于jQuery datepicker导致页面溢出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!