jQuery 日期选择器不随页面滚动而移动 [英] jQuery Date picker not moving with page scroll
问题描述
我使用的是标准的 jQuery UI 日期选择器,但是当我滚动页面时,日期选择器保持固定.任何想法如何解决这个问题?
I am using the standard jQuery UI datepicker ,However when i scroll the page the date picker remains fixed . Any ideas how to solve this ?
问候,尼尔
推荐答案
问题是日期选择器在外部 div
带有overflow: scroll;代码>.如果日期选择器是在容器内生成的,这将不是问题.
The problem is that the datepicker is outside the div
with overflow: scroll;
. If the datepicker was generated inside the container this wouldn't be a problem.
解决方案:http://jsfiddle.net/jbK6a/15/
我将日期选择器放在带有 beforeShow
事件的输入后面.
I placed the datepicker behind the input with the beforeShow
event.
我在可滚动容器上使用了 position:relative;
以便绝对元素监听容器.
And I used position: relative;
on the scrollable container so that de absolute element listens to the container.
这篇关于jQuery 日期选择器不随页面滚动而移动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!