1

我正在使用这个脚本: http ://www.teylyn.com/wp-content/uploads/2012/03/MegaMenuScript.txt

在我将鼠标移开导航按钮后,下拉菜单会停留/停留。

这是我的代码:

<ul id="topnav" style="z-index: 1000;">
    <li class="toplevel about">
        <asp:HyperLink runat="server" ID="lnkAbout" NavigateUrl="~/Aboutus/Default.aspx" Text="About Us" CssClass="about" />
        <div class="sub">
            <asp:Menu ID="mnAboutUs" runat="server" DataSourceID="smdsAboutUs" RenderingMode="List" SkipLinkText="" Orientation="Vertical" StaticEnableDefaultPopOutImage="false" DynamicEnableDefaultPopOutImage="false" />
        </div>
    </li>
    <li class="toplevel equipment">
        <asp:HyperLink runat="server" ID="lnkEquipment" NavigateUrl="~/Equipment/Default.aspx" Text="Equipment" />
        <div class="sub">
            <asp:Menu ID="mnEquipment" runat="server" DataSourceID="smdsEquipment" RenderingMode="List" SkipLinkText="" Orientation="Vertical" StaticEnableDefaultPopOutImage="false" DynamicEnableDefaultPopOutImage="false" />
        </div>
    </li>
</ul>

样式是:

div.sub
{
    height: 1500px;
    display: none;
    z-index: 99999;
    position: absolute;
}
li.toplevel
{
    float: left;
    display: block;
    position: relative;
    z-index: 99999;
}
li.toplevel a
{
    color: #000000;
    display: block;
    font-size: 1.6em;
    font-weight: normal;
    line-height: 36px;
    position: relative;
    z-index: 99999;
    text-align: center;
    text-decoration: none;
    border-left: 1px solid #FD3;
    border-right: 1px solid #D90;
}

当我将鼠标悬停时,如何使第二个设备 div 类“sub”隐藏起来?

4

1 回答 1

1

在鼠标悬停事件上试试这个:

$(".sub").eq(1).hide(); //the number after eq() is the index of the element that contain the sub class

祝你好运!

于 2012-06-25T23:07:42.240 回答