添加什么jquery所以
  • 的背景是这样的将鼠标悬停在子项目(div)上时保持突出显示
  • 发布于 2024-10-07 00:34:12 字数 2957 浏览 7 评论 0原文

    我有一个下拉菜单,当鼠标悬停在链接上时,会显示一个子 div。该脚本工作正常,只是当我将鼠标放入该细分时,父链接的背景不再像通常将鼠标悬停在其上时那样保持突出显示状态。我想我想用相关的 div 来突出显示#megamenu。下面是代码,请帮忙。

    我的网站,到目前为止只有 about dke 下拉菜单,但它完成了我所说的...

    http: //www.nestudiosonline.com/test.php

    html:

    <ul id="menu">
            <li class="mega"><a class="dkeorg" href="#">DKE.ORG</a></li>
            <li class="megamenu" id="dave"><a class="links" href="#">ABOUT DKE</a> <div id="aboutdke">div content  </div></li>
            <li class="megamenu"><a class="links" href="#">ALUMNI</a></li>
            <li class="megamenu"><a class="links" href="#">UNDERGRADUATES</a></li>
            <li class="megamenu"><a class="links" href="#">EVENTS</a></li>
            <li class="megamenu"><a class="links" href="#">MULTIMEDIA</a></li>
            <li class="megamenu"><a class="links" href="#">SHOP DKE</a></li>
          </ul>
    

    CSS

    ul#menu
    {
        display:block;
        list-style-type:none;
        margin:0;
        padding:0;
    }
    
    ul# menu li
    {
        display:inline;
        position: relative;
        }
    
    ul#menu div {
      display: none;
    }
    
    ul#menu li.mega div {
        position: absolute;
    }
    
    ul#menu li.hovering div {
      display: block;
    }
    
    #aboutdke
    {
        display:block;
        color:#FFF;
        text-align:left;
        font-family:Verdana, Geneva, sans-serif;
        font-size:10px;
        background-color:#000;
        margin:0;
        padding-top:10px;
        padding-right:10px;
        padding-bottom:10px;
        padding-left:10px;
        border:0px;
        width:910px;
        height:280px;
        float:left;
        position:absolute;
        z-index:99999;
        top:164px;
        left:140px;
    }
    
    a.links:link
    {
        display:block;
        width:120px;
        height:22px;
        padding-top:8px;
        padding-left:3px;
        padding-bottom:0px;
        color:#FFF;
        text-decoration:none;
        text-align:center;
        outline:none;
        float:left;
    }
    
    a.links:visited 
        {
        display:block;
        width:120px;
        height:22px;
        padding-top:8px;
        padding-left:3px;
        padding-bottom:0px;
        color:#FFF;
        text-decoration:none;
        text-align:center;
        outline:none;
        float:left;
        } 
    
    /* mouse over link */
    
    a.links:hover
        {
        display:block;
        width:120px;
        height:22px;
        padding-top:8px;
        padding-left:3px;
        padding-bottom:0px;
        color:#FFF;
        text-decoration:underline;
        text-align:center;
        outline:none;
        background-color:#000;
        float:left;
        }   
    
    /* selected link */
    
    a.links:active
        {
        display:block;
        width:120px;
        height:22px;
        padding-top:8px;
        padding-left:3px;
        padding-bottom:0px;
        color:#FFF;
        text-decoration:underline;
        text-align:center;
        outline:none;
        background-color:#000;
        float:left;
        }
    

    jquery:

    I have a dropdown menu that when the mouse hovers over a link a sub div shows. The script works fine except that when I put my mouse into that subdiv the parent link's background doesnt stay highlighted any longer like it normally does when it's being hovered over. I guess it is the #megamenu that i want to stay highlighted with the associated div. Below is the code please help.

    My site, only the about dke dropdown was so far, but it does what i am talking about...

    http://www.nestudiosonline.com/test.php

    html:

    <ul id="menu">
            <li class="mega"><a class="dkeorg" href="#">DKE.ORG</a></li>
            <li class="megamenu" id="dave"><a class="links" href="#">ABOUT DKE</a> <div id="aboutdke">div content  </div></li>
            <li class="megamenu"><a class="links" href="#">ALUMNI</a></li>
            <li class="megamenu"><a class="links" href="#">UNDERGRADUATES</a></li>
            <li class="megamenu"><a class="links" href="#">EVENTS</a></li>
            <li class="megamenu"><a class="links" href="#">MULTIMEDIA</a></li>
            <li class="megamenu"><a class="links" href="#">SHOP DKE</a></li>
          </ul>
    

    CSS

    ul#menu
    {
        display:block;
        list-style-type:none;
        margin:0;
        padding:0;
    }
    
    ul# menu li
    {
        display:inline;
        position: relative;
        }
    
    ul#menu div {
      display: none;
    }
    
    ul#menu li.mega div {
        position: absolute;
    }
    
    ul#menu li.hovering div {
      display: block;
    }
    
    #aboutdke
    {
        display:block;
        color:#FFF;
        text-align:left;
        font-family:Verdana, Geneva, sans-serif;
        font-size:10px;
        background-color:#000;
        margin:0;
        padding-top:10px;
        padding-right:10px;
        padding-bottom:10px;
        padding-left:10px;
        border:0px;
        width:910px;
        height:280px;
        float:left;
        position:absolute;
        z-index:99999;
        top:164px;
        left:140px;
    }
    
    a.links:link
    {
        display:block;
        width:120px;
        height:22px;
        padding-top:8px;
        padding-left:3px;
        padding-bottom:0px;
        color:#FFF;
        text-decoration:none;
        text-align:center;
        outline:none;
        float:left;
    }
    
    a.links:visited 
        {
        display:block;
        width:120px;
        height:22px;
        padding-top:8px;
        padding-left:3px;
        padding-bottom:0px;
        color:#FFF;
        text-decoration:none;
        text-align:center;
        outline:none;
        float:left;
        } 
    
    /* mouse over link */
    
    a.links:hover
        {
        display:block;
        width:120px;
        height:22px;
        padding-top:8px;
        padding-left:3px;
        padding-bottom:0px;
        color:#FFF;
        text-decoration:underline;
        text-align:center;
        outline:none;
        background-color:#000;
        float:left;
        }   
    
    /* selected link */
    
    a.links:active
        {
        display:block;
        width:120px;
        height:22px;
        padding-top:8px;
        padding-left:3px;
        padding-bottom:0px;
        color:#FFF;
        text-decoration:underline;
        text-align:center;
        outline:none;
        background-color:#000;
        float:left;
        }
    

    jquery:

    如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

    扫码二维码加入Web技术交流群

    发布评论

    需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

    评论(1

    梦情居士 2024-10-14 00:34:12

    你可以用 css 来做到这一点。 行更改

    a.links:hover
    

    为:

    a.links:hover, .megamenu.hovering a.links
    

    将topbanner_back.css 中的

    基本上,您是说当一个对象具有“megamenu”类和“悬停”类时,具有“链接”类的标签应该看起来像悬停在上面时的样子。

    You can do this with css. Change the line

    a.links:hover
    

    to:

    a.links:hover, .megamenu.hovering a.links
    

    in topbanner_back.css.

    Basically, you are saying that when a object has a class of 'megamenu' AND 'hovering', that tags with the class 'links' should look like they do when they are hovered over.

    ~没有更多了~
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文