admin管理员组文章数量:1431391
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 ?
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 ?
Share Improve this question asked Apr 22, 2010 at 16:20 nc3bnc3b 16.3k5 gold badges53 silver badges63 bronze badges 3- How about using $("body").css("overflow", "hidden"); to prevent the page from scrolling, if you never want it to scroll? Also, have you tested on multiple browsers? – Adam Commented Apr 22, 2010 at 16:27
- In the end I will set the overflow to hidden for the entire body, but I would like to do so as a failsafe. First I need to find out why this is happening. EDIT: This happens in firefox 3.6.3, iexplore 8, opera 10.50 – nc3b Commented Apr 22, 2010 at 16:28
- Maybe it would be easier to help if you provided the page? – SamB Commented Apr 23, 2010 at 0:15
1 Answer
Reset to default 5I 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>');
}
本文标签: javascriptjQuery datepicker causes page overflowStack Overflow
版权声明:本文标题:javascript - jQuery datepicker causes page overflow - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745572228a2664114.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论