简体   繁体   English

jQuery的巨型菜单鼠标悬停不工作

[英]jquery mega menu mouse hover not working

I am trying to build a MEGA MENU using jquery and css using the following code: 我正在尝试使用以下代码使用jquery和css构建MEGA MENU:

$(".sub-menu").find('a.amenu').hover(function(){
        $(this).parent().find(".sub-menu-panel").show();
    }
    ,function(){
        $(this).parent().find(".sub-menu-panel").hide();
    }
);        

where the menu links has a class called "sub-menu" and the panel related to it has a class called "sub-menu-panel". 菜单链接的类别为“子菜单”,而与之相关的面板的类别为“子菜单-面板”。

How to keep the related panel of a menu link visible if the mouse hover it ? 如果鼠标悬停在菜单链接的相关面板上,如何使该面板可见? my problem is when i move the mouse over a panel to click any sub-link on it the panel it self disapeared because the mouse out event fired when i leave the main link. 我的问题是,当我将鼠标移到面板上以单击面板上的任何子链接时,该子链接会自动消失,因为当我离开主链接时会触发鼠标移出事件。

Firstly - providing an example of what you're trying to explain would be advantageous to getting a working response. 首先-提供您要解释的示例将有助于获得有效的响应。

Secondly - you shouldn't need any javascript/jQuery to show a submenu on hover - a simple :hover mechanic in CSS should give you the effect you want. 其次-您不需要任何javascript / jQuery来显示悬停子菜单-CSS中的简单:hover机制应该可以为您带来想要的效果。

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

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