bgiframe 与 jQuery UI 1.8.9 对话框和 jQuery 1.5

发布于 2024-10-18 02:33:51 字数 799 浏览 1 评论 0原文

所以我使用 jQuery UI 的对话框。但正如我所读到的,IE6 中有一个常见的错误(不幸的是我必须确保它适用),其中下拉列表不关注 z-index 队列。我还读到有一个名为 bgiframe 的方便插件可以解决我的覆盖问题。我发现人们说有两种不同的使用方法,但都不起作用。我可能只是做了一些非常愚蠢的事情,但我需要让它发挥作用。

包括 jQuery.bgiframe.js 版本 2.1.1 以下是我尝试在不工作的情况下使用它的两种方法:(我已将所有 jQuery-UI、jQuery 和 bgiframe 包含在我正在处理的页面中)

  1. 实际插件的文档说这样做:< /p>

    $("#selectDropdownThatNeedsFishing").bgiframe();
    

    这会导致一个 jQuery 异常,说“需要对象”。

  2. 我从以下页面看到的第二种方式: http://docs.jquery.com /UI/Dialog/dialog 基本上,您只需在初始化对话框时设置 bgiframe: true 即可:

    $( ".selector" ).dialog({ bgiframe: true });
    

这不会出错,但当我在 IE6 中仍然存在问题测试一下。

我错过了什么吗?我应该以哪种方式使用bgiframe?任何方向将不胜感激。感谢您的帮助!

So I am using jQuery UI's dialog box. But as I have a read there is a common bug within IE6 (which is unfortunate that I have to make sure this works for) where dropdown lists do not pay attention to z-index queues. I have also read that there is a handy plugin out there called bgiframe to take care of my overlay woes. I have found 2 different ways people say to use it, and neither work. I may just be doing something really stupid but I need to get this working.

including jQuery.bgiframe.js Version 2.1.1
Here are the 2 ways I have attempted to use it without working: (I have included all jQuery-UI, jQuery, and bgiframe in the page that I am working on)

  1. The documentation from the actual plugin says do this:

    $("#selectDropdownThatNeedsFixing").bgiframe();
    

    This cause a jQuery exception saying saying Object expected.

  2. The second way that I saw from the following page: http://docs.jquery.com/UI/Dialog/dialog basically you just set bgiframe: true when you initialize the dialog:

    $( ".selector" ).dialog({ bgiframe: true });
    

This does not error out, but the problem still exists within IE6 when I test it out.

Am I missing something? Which way am I supposed to use bgiframe? Any direction would be much appreciated. Thank you for your help!

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

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

发布评论

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

评论(2

盗琴音 2024-10-25 02:33:51

您不需要为此使用插件。 IE6 和 z-index 的问题是,IE6 中的定位元素会生成一个以 z-index 值 0 开头的新堆栈上下文。因此 z-index 在 IE6 中无法正常工作。此问题的解决方法是在父选择器中指定一个等于子选择器中指定的 z 索引值。

检查工作示例 http://jsfiddle.net/ebgnu/2/

下面是我做的示例在jsfiddle中。

.parent{
    position: relative;
    color:white;
}
.parent#a {
    height: 2em;
    z-index: 1;
}
.parent#a .child{
    position: absolute;
    height: 6em;
    width: 2em;
    z-index: 1;
    background:blue;
}
.parent#b {
    height: 2em;
    background:red;
}

<div class="parent" id="a">
    <div class="child">a</div>
</div>
<div class="parent" id="b">
    <div class="child">b</div>
</div>

查看 .parent#a 这是 z-index 为 1 的子选择器 a 的父选择器。在此示例中,a 将位于 b 之上。假设我们想让 b 位于 a 之上。我们需要做的就是将子级 a 及其父级的值更改为 z-index: 0。这会将其发送到后面。

You don't need to use a plugin for this. The problem with IE6 and z-index is, positioned elements in IE6 generate a new stacking context starting with a z-index value of 0. Therefore z-index doesn’t work correctly in IE6. The workaround to this issue is to specify a z-index value in the parent selector that is equal to the z-index specified in the child selector.

Check working example at http://jsfiddle.net/ebgnu/2/

Below is the example i did in jsfiddle.

.parent{
    position: relative;
    color:white;
}
.parent#a {
    height: 2em;
    z-index: 1;
}
.parent#a .child{
    position: absolute;
    height: 6em;
    width: 2em;
    z-index: 1;
    background:blue;
}
.parent#b {
    height: 2em;
    background:red;
}

<div class="parent" id="a">
    <div class="child">a</div>
</div>
<div class="parent" id="b">
    <div class="child">b</div>
</div>

Look at .parent#a This is the parent of the child selector a that have a z-index of 1. In this example, a will be on top of b. let's say we want to make b on top on a. All we need to do is change values of both the child a and it's parent to z-index: 0. This will send it to the back.

波浪屿的海角声 2024-10-25 02:33:51

我相信您应该在 dialog 上调用 bgiframe 插件,而不是 选择>
当前的 jQuery UI 版本似乎不再列出对话框小部件的 bgiframe 选项。

您收到的 jQuery 异常似乎表明,指定的选择器 (#selectDropdownThatNeedsFishing) 不存在您所定位的元素。

如果问题仍然存在,请尝试使用 IE 开发人员工具栏来查明 iframe 是否实际创建。

I believe that you're supposed to call the bgiframe plugin on the dialog, not the < select >.
The current jQuery UI version doesn't seem to list the bgiframe option for the dialog widget anymore.

The jQuery Exception you're getting seems to indicate, that the element that you're targeting doesn't exist for the selector specified (#selectDropdownThatNeedsFixing).

If the problem persists, try to use the IE Developer Toolbar to find out if the iframe is actually created.

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