覆盖在第一页加载时奇怪可见的 jQuery UI Datepicker div. [英] Override jQuery UI Datepicker div visible strangely on first page load.

查看:20
本文介绍了覆盖在第一页加载时奇怪可见的 jQuery UI Datepicker div.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这里发生了一些奇怪的事情:

Something strange afoot, here:

Datepicker 的一个实例显示在一个奇怪的地方,作为 页面.

An instance of Datepicker is showing up in a weird place as a single bar in the upper left hand corner of this page.

我在页面上同时使用 jQuery UI 的 Datepicker 和 Accordion.在 UI 的 CSS 中,Datepicker 的 display:none 似乎被 Accordion 的 display:block 覆盖,至少根据 Firebug 的说法(参见下面的 img).

I'm using both jQuery UI's Datepicker and Accordion on a page. In the CSS for the UI, the display:none for Datepicker seems to be overridden by the display:block for the Accordion, at least according to Firebug (see img below).

然后,一旦在餐饮/活动室"选项卡中单击 Datepicker 触发器(单击其中一个按钮以使用 Datepicker 显示 div),display:none 似乎就可以工作了.

Then, once the Datepicker trigger is clicked in the 'catering/event room' tab (click one of the buttons to show div with Datepicker,) the display:none seems to then work.

以下是坏 div 的样子:

Here's what the bad div looks like:

这里是 Firebug 面板:

and here's the Firebug panel:

推荐答案

我遇到了同样的问题,虽然上述一些解决方案有效,但最简单的解决方法是将其添加到您的 css 中:

I had the same problem and while some of the above solutions work, the easiest fix of all is to add this to your css:

#ui-datepicker-div {display: none;}

当无法绑定到现有的不可见元素时,这基本上隐藏了重新对齐的日期选择器元素.您隐藏它,但是当您单击需要显示日期选择器的元素时,它将再次初始化.重新初始化后,id 为 #ui-datepicker-div 的 datepicker 元素将具有正确的位置.

This basically hides the realigned datepicker element when it cannot be binded to an existing invisible element. You hide it, but it will be initialized again when you click on an element that needs to display the datepicker. Upon re-initialization, the datepicker element with id #ui-datepicker-div will have the correct position.

这篇关于覆盖在第一页加载时奇怪可见的 jQuery UI Datepicker div.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆