Close a menu with an anywhere click

后端 未结 5 1998
无人共我
无人共我 2021-01-06 17:18

As you guys can see, I have a drop down menu.

I have a lot of columns, each one has an option to open the menu.

$(\".optionCont\").live(\"click\", fu         


        
5条回答
  •  遥遥无期
    2021-01-06 17:56

    $('body').bind("click",function (){
        $(".dropMenuCont").slideUp();
    });
    $('.dropMenuCont').click(function(event){
        event.stopPropagation();
    });
    

    I think a better idea to check if something is hidden is to toggle the class on your menu in a callback of the animation and then check it with hasClass.

提交回复
热议问题