iframe shimming 或 ie6(及更低版本)选择 z-index 错误

发布于 2024-07-07 21:06:02 字数 421 浏览 8 评论 0原文

嗯,不知道有没有人遇到过这个问题
简短的描述是在 IE6 上,任何 重叠时,您的 div 将显示为好像它位于

我尝试过谷歌搜索并找到了 iframe shim 解决方案
但我想要一些非常干净的替代品 或者更好的是有人找到了更好的解决方案吗? 因为使用 iframe 的方法使用大约 130mb 的 RAM 可能会减慢穷人的机器速度

Uhm I'm not sure if anyone has encountered this problem
a brief description is on IE6 any <select> objects get displayed over any other item, even div's... meaning if you have a fancy javascript effect that displays a div that's supposed to be on top of everything (e.g: lightbox, multibox etc..) onclick of a certain element and that div overlaps a <select> your div get's to be displayed as if it's under the <select> [on this case a max and minimum z-index doesn't work ]

I've tried googling and found the iframe shim solution
but I wanted some pretty clean alternatives
or better yet has anyone found a better solution?
since the method using iframes uses around 130mb of ram might slow down poor people's machines

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

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

发布评论

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

评论(7

小清晰的声音 2024-07-14 21:06:02

您不必使用循环隐藏每个select。 您所需要的只是一个 CSS 规则,例如:

* html .hideSelects select { visibility: hidden; }

和以下 JavaScript:(

//hide:
document.body.className +=' hideSelects'

//show:
document.body.className = document.body.className.replace(' hideSelects', '');

或者,您可以使用您最喜欢的 addClass / removeClass 实现)。

You don't have to hide every select using a loop. All you need is a CSS rule like:

* html .hideSelects select { visibility: hidden; }

And the following JavaScript:

//hide:
document.body.className +=' hideSelects'

//show:
document.body.className = document.body.className.replace(' hideSelects', '');

(Or, you can use your favourite addClass / removeClass implementation).

淡忘如思 2024-07-14 21:06:02

有一个名为 bgiframe 的 jquery 插件,它使 iframe 方法非常容易实现。

就我个人而言,作为一名 Web 开发人员,我已经不再关心 IE6 中的用户体验了。 我将使其渲染尽可能接近“正确”,并确保其功能正常,但就速度而言,太糟糕了。 他们可以升级。 IE7(尽管与其他浏览器相比仍然很慢)已经推出两年了(几乎到今天!)。 IE8 即将发布。 Firefox 适用于所有平台。 Safari 也是一个选择(而且速度超快)。 Opera 适用于大多数/每个平台。

IE6 发布已有 7 年多了。 恕我直言,除了懒惰的用户和无能的 IT 部门(或者如果您是 Web 开发人员)之外,没有理由继续使用它。

There is a plugin for jquery called bgiframe that makes the iframe method quite easy to implement.

Personally, as a web developer, I'm to the point where I no longer care about the user experience in IE6. I'll make it render as close to "correct" as possible, and make sure it's functional, but as far as speed goes, too bad. They can upgrade. IE7 (though still quite slow, compared to every other browser) has been out for 2 years (almost to the day!). IE8 is going to be out shortly. Firefox is available for every platform. Safari is also an option (and super fast). Opera is available for most/every platform.

IE6 was released in over 7 years ago. IMHO, there is no reason to still be using it, other than lazy users and incompetent IT departments (or if you're a web developer).

身边 2024-07-14 21:06:02

如果有人感兴趣,这里有一些 IE 填充代码。

* html .shimmed {
    _azimuth: expression(
        this.shimmed = this.shimmed || 'shimmed:'+this.insertAdjacentHTML('beforeBegin','<iframe style="filter:progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0);position:absolute;top:0px;left:0px;width:100%;height:100%" frameBorder=0 scrolling=no src="javascript:false;document.write('+"''"+');"></iframe>'),
        'inherit');
}

参考:此要点作者:subtleGradient 和这个 扎克·莱瑟曼的帖子

in case anyone is interested, here's some IE shimming code.

* html .shimmed {
    _azimuth: expression(
        this.shimmed = this.shimmed || 'shimmed:'+this.insertAdjacentHTML('beforeBegin','<iframe style="filter:progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0);position:absolute;top:0px;left:0px;width:100%;height:100%" frameBorder=0 scrolling=no src="javascript:false;document.write('+"''"+');"></iframe>'),
        'inherit');
}

ref: this gist by subtleGradient and this post by Zach Leatherman

假扮的天使 2024-07-14 21:06:02

在 IE7 之前,下拉列表是一个“窗口”控件,这意味着它直接由 Windows 呈现为控件,而不是由浏览器合成它。 因此,它不可能支持针对其他合成控件的 z 索引。

为了显示在 DDL 上,您必须使用另一个窗口控件,例如 IFRAME。 您还可以使用一个鲜为人知的 IE 专用功能,称为 window.createPopup(),它本质上是一个无边框弹出窗口。 它有局限性,比如无法阻止的点击,但如果您正在构建悬停菜单系统,它们实际上有点帮助。

Prior to IE7 the drop down list was a "windowed" control meaning that it was rendered as a control directly by Windows rather than the browser synthesizing it. As such, it wasn't possible for it to support z-indexing against other synthesized controls.

In order to appear over a DDL, you must use another windowed control, like IFRAME. You can also use a little known IE-only feature called window.createPopup() which essentially makes a chromeless popup. It has limitations, like unstoppable click-out, but they are actually kinda helpful if you are building a hover menu system.

舟遥客 2024-07-14 21:06:02

针对烦人的 IE 错误的最简单、最优雅的解决方案可以在以下位置找到: http://docs.jquery.com /Plugins/bgiframe 使用 jQuery。

我花了 2 天的时间尝试让它与 WebSphere Portal / Portal Applications 一起工作,其中一切都是动态的,包括悬浮菜单,我得出了这个结论。

The simplest and most elegant solution to that annoying IE bug is found at: http://docs.jquery.com/Plugins/bgiframe using jQuery.

I reached that conclusion after trying for 2 days to make it work with WebSphere Portal / Portal Applications where everything is dynamic, including the fly-over menu.

心房的律动 2024-07-14 21:06:02

还有我正在开始探索的 activex 方法。 它需要创建条件代码来使用 ActiveX 控件而不是 ie6 的选择框。 有一个演示脚本展示了该技术,它是此处进行了更详细的讨论

更新:看来用户计算机上的 Active-X 控件需要 MS Office。 从理论上讲,也许可以以某种方式将其包含在某个地方,但这会变得更加混乱。

There's also the activex method, which I'm starting to explore. It requires creating conditional code to use an activex control instead of a select box for ie6. There's a demo script showing the technique, which is discussed in more detail here.

Update: it appears that MS Office is required for the active-x control to be on the user's machine. In theory, it might be possible to include that somewhere, somehow, but that's getting a lot messier.

青衫负雪 2024-07-14 21:06:02

我知道很多人提出了自己的技巧,但就我而言,我只是简单地使用 jquery 隐藏选择,如下所示。

$(':date').dateinput({
    format: 'dd/mm/yyyy',
    onBeforeShow: function(event) {
        $('select').hide();
    },
    onHide: function(event) {
        $('select').show();
    }
});

I know many people suggested their own tips, but in my case, I just simply hide select using jquery like the below.

$(':date').dateinput({
    format: 'dd/mm/yyyy',
    onBeforeShow: function(event) {
        $('select').hide();
    },
    onHide: function(event) {
        $('select').show();
    }
});
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文