• Enable Click Effect

    Possible duplicate:
    How to detect a click outside an element?

    <ul id="rightNav"> <li id="SettingOpt"> <a href="javascript:void(0)">username<span class="fabShopSprite iRecentIcon iUserIcon"></span></a> <div class="userMenu"> <ul> <li><a class="Setting" href="/">Settings</a></li> <li><a class="Setting lastShadow" href="/">Logout</a></li> </ul> </div> </li> </ul> 

    It works like a menu, but my requirement is that when the user clicks the side of the block from which he is going and the other effect I want to switch, the switching effect works fine for me, but when I leave the wrap side #rightNavToggle does not go away. My other requirement is that when the user clicks on his subnavigation, subnavigation should be disabled again. Used Java script

     $("#SettingOpt a").click(function() { var parent = $(this).parent(); parent.toggleClass("selected"); parent.find("div.userMenu").toggle(); }); 
    +6
    source share
    1 answer

    Just made a simple example based on @syrion ref. http://jsfiddle.net/cfmitrah/5grcu/

    +2
    source

    Source: https://habr.com/ru/post/885607/


    All Articles