views:

45

answers:

3

Hi At this site: http://www.multiway.dk/ The dropdown menu is displaying behind the header image, which i dont quite understand as the menu has z-index: 100; and the image has z-index:1;

It works fine in FF, but in IE it doens't work??

A: 

Yeh I had this a while back. I personally used:

http://brenelz.com/blog/squish-the-internet-explorer-z-index-bug/

plenty of fixes out there (:

Adam
Hmm, so do i put z-index: 3000; on my menu, and z-index:1000; on the menu container? Cant quite figure out how to use it? :S
Nicky Christensen
A: 

This is the famous Z-Index Bug

For some reason, Internet Explorer does some pretty funky things, and has several known bugs with it’s rendering engine that drive web developers like me crazy. While most of the known bugs occur in relatively obscure situations and go largely unnoticed, there are a few that really stick out and cause web developers to waste many hours trying to fix them. The way IE7 renders z-index stacking orders is one of them.

One way to fix many of the issues with IE7 is to dynamically reverse the default z-index stacking order of the elements on your page. This will ensure the elements higher in your HTML source will also have a higher z-index order on your page, solving most of the IE stacking issues. If you’re using jQuery (the best Javascript library there is), here’s the quick fix:

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

Ref


Edit : Move that jquery code to IE conditional comments.

<!--[if IE lte 7]>
<script type="text/javascript">
$(document).ready(function(){

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

$(".panel img").css("z-index","-1");
$(".menu_item").css("overflow","visble");


});

</script>
<![endif]-->
DMin
I tried this, and if you look at the code now it contains the jQuery, but it still wont work ?
Nicky Christensen
@Nicky : See if the edited code works. Remove it from the main code(its causing problem in other browsers) and put it in the IE conditional code.
DMin
It partially works - The third level is now disapering?
Nicky Christensen
And it's only in Ie7 it works, not IE8 ?
Nicky Christensen
I think it should be okay by default in IE8(assuming) try changing the conditional code to [if IE lte 7] (updated above) this will trigger the code only in IE lte (less than or equal to) 7. For the inner divs on the menu -- i've added $(".menu_item").css("overflow","visble"); to the IE comments, see if that helps.
DMin
Still doens't work in IE8, take a look: http://www.multiway.dk/
Nicky Christensen
Dont have IE8 :( - best of luck though
DMin