title: how to close menu when click outside it
body: <p>I have a drop down menu and I want the behaviour such that when clicked outside the menu, it closes.</p>
  
  <p>This is my jQuery code:</p>
  
  <pre><code>        &lt;script&gt;
      $(document).ready(function(){
        $(".a-for-noti-scroll").on("click",function(){
            $("#nano").toggleClass("x");
            $(".top-triangle-noti-scroll").toggleClass("y");
            e.stopPropagation();
        });
        $("body").on("click",function(e){
            $('#nano').css('visibility', 'hidden');
            $(".top-triangle-noti-scroll").css('display', 'none');
            e.stopPropagation();
        });   
      });
      &lt;/script&gt;
  </code></pre>
  
  <p>But this doesn't work.</p>
  
  <p>I tried <code>.hide()</code> for the <code>body</code>, but in this way the menu does not open.
  What should I do?</p>