切换不在菜单中悬停

时间:2023-01-01 19:41:12

I have been fighting a lot with this for many hours and seems strange when I see the same working on Fiddle but the same thing doesn't work in my code. Here, I paste my HTML and JS, CSS can be seen here: http://jsfiddle.net/rd6bX/76/

我已经花了很多时间与它斗争了很多时间,当我看到同样的工作在Fiddle上时看起来很奇怪,但同样的事情在我的代码中不起作用。在这里,我粘贴我的HTML和JS,CSS可以在这里看到:http://jsfiddle.net/rd6bX/76/

<div class="center-menu">       
        <ul>
                <li class="bbw-user-link glyphicon glyphicon-chevron-left" ><a href="" style="color:white;">item to be hovered</a>

                    <div class="menu middle">
                    <ul>
                            <li><a href="#">Some Menu Item</a></li>
                            <li><a href="#">Another Item</a></li>
                            <li><a href="#">Another Item</a></li>

                    </ul>                       
                    </div>                  

                </li>

        </ul>

JQuery code:

jQuery('.center-menu ul li').hover(function () {
    jQuery(this).children('.menu.middle').toggle();
}); 

1 个解决方案

#1


0  

Try this:

jQuery(function (){
  jQuery('.center-menu ul li').hover(function () {
    jQuery(this).children('.menu.middle').toggle();
  }); 
});

#1


0  

Try this:

jQuery(function (){
  jQuery('.center-menu ul li').hover(function () {
    jQuery(this).children('.menu.middle').toggle();
  }); 
});