mirror of
https://github.com/panr/hugo-theme-terminal.git
synced 2024-12-02 12:16:38 +03:00
18 lines
690 B
JavaScript
18 lines
690 B
JavaScript
const mobileQuery = getComputedStyle(document.body).getPropertyValue("--phoneWidth");
|
|
const isMobile = () => window.matchMedia(mobileQuery).matches;
|
|
|
|
if(!isMobile()) {
|
|
languageSelector = document.querySelector(".language-selector-current");
|
|
moreLanguagesContainer = document.querySelector(".language-selector__more");
|
|
|
|
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");
|
|
});
|
|
}
|