Close menu on outside click. Tricky example
<p>I have a menu that consists of tabs.</p>

<p>I want this menu to close on outside click and stay active when you click inside of it and open tabs.</p>

<p>I have found a solution <a href="http://stackoverflow.com/questions/2868582/click-outside-menu-to-close-in-jquery">here</a></p>

<p>It looks like this :</p>

<pre><code>$('html').click(function() {
    //Hide the menus if visible
});

$('#menucontainer').click(function(event){
    event.stopPropagation();
});
</code></pre>

<p>But it doesn't work in my case, because after applying it, tabs become unclickable.</p>

<p>Here is my markup:</p>

<pre><code>&lt;button&gt;Open menu&lt;/button&gt;
&lt;div class="menu"&gt;Tabbable content here&lt;/div&gt;
</code></pre>
