jQuery UI 对话框标题栏问题

发布于 2024-10-04 18:13:04 字数 870 浏览 7 评论 0原文

我希望其他人也经历过这种情况,并能为我指出原因/修复的正确方向。

我遇到的问题是我正在使用 jQuery UI 对话框进行某些表单输入。当对话框显示时,它完全没有标题栏。我在 firebug 中打开它,注意到有一个 CSS 项,如下所示;

element.style {
  display:none;
}

Firefox 中的 element.style 似乎指的是 /html/body/div[3]/div,它是用于标题栏本身的 div。当我禁用显示时:无;标题栏变得可见。所以,我知道是什么原因导致的,但 css 似乎是 jquery 本身可能发生的事情的结果。

我最初认为我的 CSS 文件可能会导致 CSS 冲突,所以我将它们注释掉并尝试仅使用 jquery 库以及自定义 css 和图像运行页面。还是得到同样的东西。

我已经为此奋斗了好几天,确实需要一些建议。

谢谢

更新:

$(document).ready(function() { 
    $("#dlgEditMlgData").dialog({ autoOpen: false, 
                                  modal: true, 
                                  show: 'blind', 
                                  hide: 'explode', 
                                  title: 'Mileage Entry Edit Utility'
    }); 
    $("#dlgEditMlgData").hide().siblings().hide();
});

I'm hoping that someone else has experienced this and can point me in the right direction as to the cause/fix.

The issue I am having is that I am using a jQuery UI-Dialog for some form input. When the dialog displays, it is devoid of the titlebar altogether. I cracked it open in firebug and noticed that there's a CSS item denoted as follows;

element.style {
  display:none;
}

The element.style, in Firefox appears to refer to /html/body/div[3]/div which is the div used for the titlebar itself. When I disable the display:none; the titlebar becomes visible. So, I know what is appearing to cause it, but it also appears that that css is the result of something happening possibly in jquery itself perhaps.

I originally thought that I might be having CSS conflicts due to my CSS files, so I commented them out and tried running the page with only the jquery libs and the custom css and images. Still get the same thing.

I have battling this for days now and could really use some advice.

Thanks

UPDATE:

$(document).ready(function() { 
    $("#dlgEditMlgData").dialog({ autoOpen: false, 
                                  modal: true, 
                                  show: 'blind', 
                                  hide: 'explode', 
                                  title: 'Mileage Entry Edit Utility'
    }); 
    $("#dlgEditMlgData").hide().siblings().hide();
});

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

旧街凉风 2024-10-11 18:13:04

您发布的代码如下:

$(document).ready(function() { 
  $("#dlgEditMlgData").dialog({ 
    autoOpen: false,
    modal: true,
    show: 'blind',
    hide: 'explode',
    title: 'Mileage Entry Edit Utility'
  }); 
  $("#dlgEditMlgData").hide().siblings().hide(); 
});

当您调用 .dialog 时,元素将移动到文档的末尾并插入到包装器中(对话框的框架)。

但之后,您对元素调用 hide 并隐藏其同级元素,这意味着您隐藏了 div 本身,但也隐藏了移动后作为 div 的同级元素的标题栏。如果您需要隐藏元素的同级元素,请尝试在创建对话框之前执行此操作。

You posted your code like this:

$(document).ready(function() { 
  $("#dlgEditMlgData").dialog({ 
    autoOpen: false,
    modal: true,
    show: 'blind',
    hide: 'explode',
    title: 'Mileage Entry Edit Utility'
  }); 
  $("#dlgEditMlgData").hide().siblings().hide(); 
});

When you call .dialog the element is moved to the end of the document and inserted into a wrapper(The frame of the dialog).

But after that you call hide on the element and also hide its' siblings which means that you hide the div itself but you also hide the titlebar which is a sibling to the div after it has been moved. If you need to hide the siblings of the element try doing so before creating the dialog.

冬天旳寂寞 2024-10-11 18:13:04

您调用 $("#dlgEditMlgData").hide().siblings().hide() 是否有原因?当您将 a 初始化为对话框并将 autoOpen 设置为 false 时,该对话框将隐藏以启动。要显示对话框,您可以调用:

$('#dlgEditMlgData').dialog('open');

无需在对话框或其同级对话框上显式调用 hide()。

Is there a reason that you're calling $("#dlgEditMlgData").hide().siblings().hide()? When you initialize a as a dialog with autoOpen set to false, the dialog is hidden to start. To show the dialog, you then call:

$('#dlgEditMlgData').dialog('open');

No need to explicitly call hide() on the dialog or its siblings.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文