hugo-theme-terminal/source/js/languageSelector.js
Marvin Dalheimer 10b545bb86 Added option for language selector
Implemented a language selector submenu that can be turned on or off by a config value.

Resolves: panr/hugo-theme-terminal#31
2019-04-01 21:44:39 +02:00

12 lines
503 B
JavaScript

const mobileQuery = getComputedStyle(document.body).getPropertyValue("--phoneWidth");
const isMobile = () => window.matchMedia(mobileQuery).matches;
if(!isMobile()) {
languageSelector = document.getElementsByClassName("language-selector-actual")[0];
moreLanguagesContainer = document.getElementsByClassName("language-selector-more")[0];
languageSelector && languageSelector.addEventListener("click", e => {
e.stopPropagation();
moreLanguagesContainer.classList.toggle("hidden");
});
}