简体   繁体   English

Z-Index CSS-顶部导航与垂直导航重叠

[英]Z-Index CSS - Top navigation overlaps vertical navigation

I have a website that i'm re-designing for a company i work for. 我有一个网站正在为我工​​作的公司重新设计。 The major difference with this website, and past projects is the website is hosted through a Web-to-Print Ecommerce company that handles most of the back-end stuff when it comes to purchases, and inventory control. 该网站与过去的项目的主要区别在于,该网站是由网络印刷电子商务公司托管的,该公司处理有关购买和库存控制的大多数后端事务。 They give me access to edit the HTML content, and the CSS. 它们使我可以编辑HTML内容和CSS。 Sadly they do not give me any access to change the Javascript Navigation. 遗憾的是,他们没有授予我任何更改Javascript导航的权限。 I'm having issues with the JavaScript Navigation overlapping my pure CSS Vertical Menu below the slideshow. 我在JavaScript导航与幻灯片下方的纯CSS垂直菜单重叠时遇到问题。 I know this has something to-do with the Z-index, but for the life of me i can not get it to work. 我知道这与Z-index有关,但是对于我一生来说,我无法使其正常工作。 Does anybody have any advice that i could use to add to the CSS to have it stop overlapping? 有人对我有什么建议可以用来添加到CSS中以使其停止重叠吗?

Here is the site so you can see what is happening - Website 这是该网站,您可以看到发生了什么- 网站

#cssmenu {
    float:left;
    position:relative;

}

#cssmenu ul {
    font-size:14px; 

}

#cssmenu ul {
    font-size:16px;

}
#cssmenu,
#cssmenu ul,
#cssmenu ul li,
#cssmenu ul li a {
  margin: 10px 0px 0px 0px;
  padding: 0;
  border: 0;
  list-style: none;
  line-height: 1;
  display: block;
  position: relative;
  -webkit-box-sizing: border-box;
  -moz-box-sizing: border-box;
  box-sizing: border-box;

}

#cssmenu {

}

#cssmenu > ul {
  width: 200px;
  background: #ffffff;

}

#cssmenu > ul > li > a {
    font-family: 'PT Sans Narrow', sans-serif;
  padding: 8px 15px;
  font-size: 16px;
  color: #666666;
  font-weight: 700;
  text-decoration: none;
  -webkit-transition: color .2s ease;
  -o-transition: color .2s ease;
  -ms-transition: color .2s ease;
  transition: color .2s ease;

}

#cssmenu > ul > li:hover > a,

#cssmenu > ul > li > a:hover {
  color: #222222;
 }
#cssmenu ul li.has-sub > a::after {
  position: absolute;
  right: 15px;
  display: block;
  width: 10px;
  height: 10px;
  content: "";
  border-radius: 2px;
}
#cssmenu > ul > li.has-sub > a::after {
  top: 14px;
  background: #666666;
}
#cssmenu > ul > li.has-sub:hover > a::after,
#cssmenu > ul > li.has-sub > a:hover::after {
  background: #222222;
}
#cssmenu ul ul li.has-sub > a::after {
  top: 13px;
  background: #ffffff;
}
#cssmenu ul ul li.has-sub:hover > a::after,
#cssmenu ul ul li.has-sub > a:hover::after {
  background: #dddddd;
}
#cssmenu ul li.has-sub > a::before {
  position: absolute;
  right: 15px;

  display: block;
  width: 0;
  height: 0;
  border: 3px solid transparent;
  content: "";
  z-index:2;
}
#cssmenu > ul > li.has-sub > a::before {
  top: 16px;
  border-left-color: #ffffff;
}
#cssmenu ul ul li.has-sub > a::before {
  top: 15px;
  border-left-color: #2e353b;
}
#cssmenu ul {
    z-index:2;
  -webkit-transform:;
  transform:;
  -webkit-perspective: 600px;
  -moz-perspective: 600px;
  perspective: 600px;
  -webkit-transform-style: preserve-3d;
  -moz-transform-style: preserve-3d;
  transform-style: preserve-3d;
}
#cssmenu ul li:hover > ul {
  left: 100%;
  opacity: 1;
  -webkit-transform: rotate3d(0, 0, 0, 0);
  transform: rotate3d(0, 0, 0, 0);
  z-index:2;
}
#cssmenu ul ul {
  position: absolute;
  top: 0;
  left: -9999px;
  width: 180px;
  background: #2e353b;
  opacity: 0;
  -moz-transition: opacity 0.2s ease, -moz-transform 0.2s ease;
  -webkit-transition: opacity 0.2s ease, -webkit-transform 0.2s ease;
  -ms-transition: opacity 0.2s ease, -ms-transform 0.2s ease;
  -o-transition: opacity 0.2s ease, -o-transform 0.2s ease;
  transition: opacity .2s ease, transform .2s ease;
  -webkit-transform: rotate3d(0, 1, 0, 45deg);
  -moz-transform: rotate3d(0, 1, 0, 45deg);
  transform: rotate3d(0, 1, 0, 45deg);
  -webkit-transform-origin: left center;
  -moz-transform-origin: left center;
  transform-origin: left center;
  -webkit-backface-visibility: hidden;
  -moz-backface-visibility: hidden;
  backface-visibility: hidden;
   z-index:2;
}
#cssmenu ul li:hover > ul {
  left: 100%;
  opacity: 1;
  transform: rotate3d(0, 0, 0, 0);
  z-index:2;
  }
#cssmenu ul ul::after {
  position: absolute;
  left: -8px;
  top: 14px;
  z-index: 5;
  display: block;
  width: 0;
  height: 0;
  border: 4px solid transparent;
  border-right-color: #2e353b;
  content: "";
   z-index:2;
}
#cssmenu ul ul a {
  padding: 8px 15px;
  font-size: 12px;
  color: #ffffff;
  font-weight: 700;
  text-decoration: none;
  -webkit-transition: color .2s ease;
  -o-transition: color .2s ease;
  -ms-transition: color .2s ease;
  transition: color .2s ease;
   z-index:2;
}

#cssmenu ul ul li:hover > a,
#cssmenu ul ul li a:hover {
  color: #dddddd;
  z-index:2;
}  

You need to increase the z-index for the JavaScript navigation. 您需要增加JavaScript导航的z-index。 You can do that with CSS. 您可以使用CSS做到这一点。

.nav_child {
    z-index: 2;
}

Only tested in Chrome on Windows. 仅在Windows的Chrome中进行了测试。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM