How to solve a complicated Z-index issue in IE7



我在处理IE7的z索引时遇到问题。我做了大量的研究,仍然无法解决我的问题。

我有

4 buttons with drop down menu. The dropdown menu has absolute position and have z-index of 9999;
 ----     ----    -----    -----
|    |   |    |  |     |  |     |
 ----     ----    -----    -----
dmenu    dmenu    dmenu    dmenu
another 4 buttons with popup images that pop on top of the button. The images also have absolute position and have z-index of 9999;
 pop img   pop img  pop img     pop img
 ----       ----    -----      -----
|    |     |    |  |     |    |     |
 ----       ----    -----      -----

 I want dropdown menu will cover the buttons below and and pop images will cover the button above. 

Chrome和FF中的一切都很好,但IE除外。下拉菜单将显示在底部按钮后面,而不是覆盖它们。

顶部按钮是下拉菜单的父项,底部按钮是弹出图像的父项。

我试过

1.设置顶部和底部按钮的相对位置。

2.运行此脚本

   var zIndexNumber = 1000;
       // Put your target element(s) in the selector below!
       $("div").each(function() {
               $(this).css('zIndex', zIndexNumber);
               zIndexNumber -= 10;
               console.log($(this));
       });

上面的脚本将修复下拉菜单以覆盖底部按钮,但也会使顶部按钮覆盖弹出图像,因为弹出图像的z索引较低。

我现在很沮丧,需要帮助。非常感谢!

试试这个:请确保下拉列表的父对象具有一个位置:relative。IE 6&IE 7 Z索引问题我通常会确保这种情况下的ul会有一个显示:块。

我要做的另一件事是将父项的z索引设置为一个较低的数字,并通过将z索引0应用于正文来设置页面上的z索引。

最新更新