2018-07-20 19:14:22 +02:00
|
|
|
// Mobile menu
|
|
|
|
|
|
|
|
const menuTrigger = document.querySelector(".menu-trigger");
|
|
|
|
const menu = document.querySelector(".menu");
|
|
|
|
const mobileQuery = getComputedStyle(document.body).getPropertyValue("--phoneWidth");
|
|
|
|
const isMobile = () => window.matchMedia(mobileQuery).matches;
|
|
|
|
const isMobileMenu = () => {
|
|
|
|
menuTrigger && menuTrigger.classList.toggle("hidden", !isMobile());
|
|
|
|
menu && menu.classList.toggle("hidden", isMobile());
|
|
|
|
};
|
|
|
|
|
|
|
|
isMobileMenu();
|
|
|
|
|
2018-07-25 00:35:03 +02:00
|
|
|
menuTrigger && menuTrigger.addEventListener("click", () => menu && menu.classList.toggle("hidden"));
|
2018-07-20 19:14:22 +02:00
|
|
|
|
|
|
|
window.addEventListener("resize", isMobileMenu);
|