Dropdown menu hides behind other elements in IE

白昼怎懂夜的黑 提交于 2020-01-13 11:38:54

问题


I have installed the Boldy theme from site5 on one of my projects and have run into one major problem.

When browsing in internet explorer (8 or lower), the top dropdown menu gets displayed behind some other elements (main content slider, H1's etc.). I've tried everything from changing all the z-index's to fixed positions, with no luck.

You can view the problem by visiting site5's Boldy demo page http://wordpress.site5.net/boldy/ and hovering over the top menu's blog tab in IE.

I have asked site5 to look into it, they are aware of the problem, but have failed to find any solutions.


回答1:


Ok originale solution here - Swiss credit website. This works but uses a complicated z-index solution. Here is very simple and improved solution here - Jeyjoo stock image gallery This works in IE6+, firefox, opera, safari and chrome

Solution

The HTML

<div id="container_page" class="container_page">
  <div id="container_header" class="container_header">
    NAV BAR GOES HERE
  </div>
  <div id="container_body" class="container_body">
    ...body text...
  </div>
</div>

The CSS

#container_page #container_header {position:relative;z-index:2;}
#container_page #container_body {position:relative;}

why it works

You have to tell IE how the two divs relate to one another.




回答2:


(not my script) Pretty sure i may have found the answer to this on here, but i cant find it. Either way, this worked great for me...

$(function() {
var zIndexNumber = 1000;
$('ul').each(function() {
    $(this).css('zIndex', zIndexNumber);
    zIndexNumber -= 10;
});
});

just make sure your css includes position and z-index so the script can access the values.

kudos to whomever came up with this - saved me a whole lot of trouble.




回答3:


If I'm not mistaken, IE is not properly inheriting the z-index from the top-nav for the children li items in the menu. That is why the Photos with a z-index of 60 are covering it up. You can do two things here.

  1. Eliminate the photo z-index.
  2. Directly specify a z-index of 100 for the sub list, not just the top-nav list.



回答4:


I see you still havent solved this on. I found a solution here on a submenu - Chkredit - swiss credit website Works in all versions of IE and is light and 100% CSS (no javascript).

Basically the problem was that IE does not use z-index correctly. Check the z-index's in the CSS code. Yo will need to put a z-index -1 on the items your menu is hiding behind.

I working on exactly the same problem for my own image gallery right now (go to "top image" page) - jeyjoo image gallery



来源:https://stackoverflow.com/questions/3972807/dropdown-menu-hides-behind-other-elements-in-ie

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!