Add body listener for trigger closing language box

This commit is contained in:
Marvin Dalheimer 2019-08-13 08:44:06 +02:00
parent 10b545bb86
commit 270a135fca

View File

@ -5,6 +5,12 @@ if(!isMobile()) {
languageSelector = document.getElementsByClassName("language-selector-actual")[0];
moreLanguagesContainer = document.getElementsByClassName("language-selector-more")[0];
document.body.addEventListener("click", () => {
if (moreLanguagesContainer && !moreLanguagesContainer.classList.contains("hidden")) {
moreLanguagesContainer.classList.add("hidden");
}
});
languageSelector && languageSelector.addEventListener("click", e => {
e.stopPropagation();
moreLanguagesContainer.classList.toggle("hidden");