I have 2 button which will toggle/remove class when user clicks on it.
$('.social-toggle').on('click', function() {
$('.social-networks').not($(this).next()).removeClass('open-menu')
$(this).next().toggleClass('open-menu');
});
Clicking on another share button will open another box at the same time the first is closed. But want Clicking anywhere outside the box close them. Do yo know how can i do that? Also here is my HTML
<div class="share-button">
<a href="#" class="social-toggle">Share</a>
<div class="social-networks">
<ul>
<li class="social-twitter">
<a href="http://www.twitter.com">T</a>
</li>
<li class="social-facebook">
<a href="http://www.facebook.com">F</a>
</li>
<li class="social-gplus">
<a href="http://www.gplus.com">G+</a>
</li>
</ul>
</div>
</div>