Answer the question
In order to leave comments, you need to log in
How to hide blocks outside of a click?
with this markup (that is, without changing the markup)
clicked on the active language - the submenu opens
clicked outside the active language - the submenu is hidden
https://jsfiddle.net/Lmr1kp6f/2/
Answer the question
In order to leave comments, you need to log in
$('.language-chooser li').on('click', function(evt) {
evt.stopPropagation();
evt.preventDefault();
$('.language-chooser li').show(); // show all languages
});
$(document).on('click', function(evt) {
$('.language-chooser li:not(.active)').hide(); // hide inactive languages
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question