From ed4f5f48884aef5141f228fb3f9435f9a10e5b7d Mon Sep 17 00:00:00 2001 From: samaradel Date: Thu, 24 Nov 2022 15:46:42 +0200 Subject: [PATCH] fis dropdown --- static/js/custom.js | 11 +++++++++++ templates/partials/header.html | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/static/js/custom.js b/static/js/custom.js index e7fc72867..4871c3333 100644 --- a/static/js/custom.js +++ b/static/js/custom.js @@ -55,6 +55,17 @@ function showMenu(menuName) { var menuBtnId = menuName + (isMobile ? '-mobile-menu' : '-menu'); var menuElement = document.getElementById(menuId) menuElement.className = menuElement.className.replace(" hidden", ""); + let children = document.querySelectorAll('.nav_menu') + for (let i = 0; i < children.length; i++) { + if (menuElement !== children[i]) { + let btnId = `${children[i].id}-btn`; + let btn = document.getElementById(btnId); + if (btn && !children[i].classList.contains('hidden')) { + children[i].classList.add('hidden') + btn.lastElementChild.classList.replace("rotate-0", "-rotate-90") + } + } + } setTimeout(function () { menuElement.className = menuElement.className.replace("duration-200 ease-in opacity-0 -translate-y-1", "duration-150 ease-out opacity-1 -translate-y-0"); }, 10); diff --git a/templates/partials/header.html b/templates/partials/header.html index ec3f42203..c67c1131a 100644 --- a/templates/partials/header.html +++ b/templates/partials/header.html @@ -126,7 +126,7 @@ {% set menu_id = header_label ~ "-menu" | slugify %}