diff --git a/app/static/css/default.css b/app/static/css/default.css index e844510..6adc62e 100644 --- a/app/static/css/default.css +++ b/app/static/css/default.css @@ -105,4 +105,12 @@ h3.footer-title{ top: 0; left: 100%; /* Positioniert das Submenü rechts vom Hauptmenü */ margin-top: -1px; +} + +.dropdown-menu.collapse { + display: none; +} + +.dropdown-menu.collapse.show { + display: block; } \ No newline at end of file diff --git a/app/static/js/close-submenus.js b/app/static/js/close-submenus.js new file mode 100644 index 0000000..1f5e2c6 --- /dev/null +++ b/app/static/js/close-submenus.js @@ -0,0 +1,21 @@ +document.addEventListener('DOMContentLoaded', () => { + const dropdownSubmenus = document.querySelectorAll('.dropdown-submenu > .dropdown-item'); + + dropdownSubmenus.forEach((submenu) => { + submenu.addEventListener('click', (event) => { + event.preventDefault(); + const targetMenu = document.querySelector(submenu.getAttribute('data-bs-target')); + const allSubmenus = document.querySelectorAll('.dropdown-menu.collapse'); + + // Schließe alle anderen Submenüs + allSubmenus.forEach((menu) => { + if (menu !== targetMenu) { + menu.classList.remove('show'); + } + }); + + // Toggle des aktuellen Submenüs + targetMenu.classList.toggle('show'); + }); + }); +}); diff --git a/app/templates/moduls/base.html.j2 b/app/templates/moduls/base.html.j2 index 8f09dc9..3a2cd75 100644 --- a/app/templates/moduls/base.html.j2 +++ b/app/templates/moduls/base.html.j2 @@ -39,6 +39,7 @@ {% include "moduls/modal.html.j2" %} + \ No newline at end of file diff --git a/app/templates/moduls/navigation.html.j2 b/app/templates/moduls/navigation.html.j2 index 768f048..483f1c3 100644 --- a/app/templates/moduls/navigation.html.j2 +++ b/app/templates/moduls/navigation.html.j2 @@ -3,33 +3,34 @@ {% for subitem in subitems %} {% if subitem.subitems %}