简体   繁体   English

如何显示要悬停的子菜单?

[英]How can display a sub-menu to hover?

I have this site: 我有这个网站:

link 链接

If you click on Products,appeear a sub-menu. 如果单击“产品”,则会出现一个子菜单。

I want to do the same when the arrow is over the menu (hover). 当箭头悬停在菜单上(悬停)时,我想做同样的事情。

I tried to use this code in JQuery but doesn`t work. 我试图在JQuery中使用此代码,但是不起作用。

jQuery(document).ready(function($) {
    //$("#menu-main-menu li").hover(function(){
    //jQuery(this).find('.sub-menu').show(1000);
    //}, function(){
    // jQuery(this).find('.sub-menu').slideToggle();
});
 //$("body").click(function() {
   // $(".sub-menu").hide(1000);
//});


  //here begins the code I tried I

    $("#menu-main-menu li").hover(function () {
        jQuery(this).find('.sub-menu').stop(true,true).delay(1000).show(0);
    }, function () {
        jQuery(this).find('.sub-menu').stop(true,true).delay(1000).hide(0);
    });



    });

Implementation is something wrong? 实施有问题吗? You can help me tell me where I was wrong for not working? 您可以帮助我告诉我我不工作的地方在哪里吗?

Thanks in advance! 提前致谢!

Try this : 尝试这个 :

jQuery(document).ready(function($) {


$("#menu-main-menu li").hover(function () {
    jQuery(this).find('.sub-menu').stop(true,true).delay(1000).show(0);
}, function () {
    jQuery(this).find('.sub-menu').stop(true,true).delay(1000).hide(0);
});



});

Explanation : 说明:

I just delete "});" 我只是删除“});”

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

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