为什么下拉菜单隐藏在jQuery按钮后面?

Arm*_*don 3 css asp.net jquery jquery-ui menu

为什么菜单下拉隐藏在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;
}
Run Code Online (Sandbox Code Playgroud)

Han*_*Han 8

我也遇到了这个问题.我找到了原因和解决方案.

原因:按钮在菜单后呈现,但它已被一些其他元素包裹jquery-ui,因此它z-index已被增加.

解决方案:为了克服这个问题,我们可以增加z-index菜单(比减少z-index许多按钮更好的方法).但请记住这一点

" z-index只适用于定位元件(position:absolute,position:relative,或position:fixed)"

那样我们也需要定位菜单.这是我的代码:

<div style="position:relative;z-index:99"> MENU HERE </div>
Run Code Online (Sandbox Code Playgroud)