为什么下拉菜单隐藏在 jQuery 按钮后面?
div.menu ul li a, div.menu ul li a:visited
{
background-color: #465c71;
border: 1px #4e667d solid;
color: #dde4ec;
display: block;
line-height: 1.35em;
padding: 4px 20px;
text-decoration: none;
white-space: nowrap;
position: relative;
z-index: 9999;
}
最佳答案
我也遇到过这个问题。我找到了原因和解决方案。
原因:按钮在菜单之后呈现,但它已被 jquery-ui
的一些附加元素包裹,因此它的 z-index
已增加。
解决方案:为了克服这个问题,我们可以增加菜单的z-index
(比减少许多菜单的z-index
更好的方法纽扣)。但请记住,
"
z-index
only works on positioned elements (position:absolute
,position:relative
, orposition:fixed
)"
所以我们也需要定位我们的菜单。这是我的代码:
<div style="position:relative;z-index:99"> MENU HERE </div>
关于jquery - 为什么下拉菜单隐藏在 jQuery 按钮后面?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12713882/