Cato Yeung
Cato Yeung

Reputation: 701

css z-index multi level

http://jsfiddle.net/Uqxxh/1/

I have a problem displaying a nav bar with a pic next to it. There is a zoom function in the pic. When mouse over it, an enlarged verion will be displayed.

I have a demo simulating the situation.

I have two requirements:
1. The enlarged tree should be on top of the nav bar.
2. The second level of nav bar shouold be on top of the small tree.

#container
{
    width: 700px;
}
#contentLeft
{
    width: 220px;
    float: left;
    z-index: 50;
}
#contentRight
{
    width: 450px;
    float: right;
    z-index: 50;
}
#navBar > li
{
    list-style-type: none;
    position: relative;
    color: #EAC789;
    border-bottom: 1px dashed #EAC789;
    background: #fff;
    width: 200px;
    line-height: 24px;
}

#navBar > li a
{
    text-decoration: none;
    color: #B38C51;
}

#navBar > li ul
{
    position: absolute;
    left: 200px;
    top: 0;
    width: 100%;
    margin-left: 0;
    padding-left: 0;
}

#navBar > li li
{
    display: none;
    background: #967644;
    border-bottom: 1px dashed #fff;
    color: #fff;
    width: 100%;
    line-height: 24px;
}

#navBar > li:hover li
{
    display: block;
}

#navBar > li li a
{
    color: #fff;
}

#mouseOverDiv
{
    position: relative;
}

#mouseOverDiv .enlargePic
{
    display: none;
    position: absolute;
    left: -200px;
    top: 0;
}

#mouseOverDiv:hover img
{
    border: 1px solid #000;
    background: #fff;
}

#mouseOverDiv:hover .enlargePic
{
    display: block;
    z-index: 9999;
}

Upvotes: 0

Views: 226

Answers (1)

Khawer Zeshan
Khawer Zeshan

Reputation: 9646

Apply z-index to #navBar > li ul should fix the issue

#navBar > li ul
{
    position: absolute;
    left: 200px;
    top: 0;
    width: 100%;
    margin-left: 0;
    padding-left: 0;
    z-index:51;
}

FIDDLE

UPDATE

Apply z-index to this class

.rpSlide{
   z-index:51;
}

Remove z-index from this class .MainLeft

Remove inline z-index from this main menu div

<div id="ctl00_ctl01_siteMenu" class="RadMenu RadMenu_Yaki" style="z-index: 7000;">

This should fix all of your issues you are having on this page

Upvotes: 2

Related Questions