mirror of
https://github.com/kevinveenbirkenbach/homepage.veen.world.git
synced 2025-01-16 03:23:59 +01:00
22 lines
818 B
JavaScript
22 lines
818 B
JavaScript
|
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');
|
||
|
});
|
||
|
});
|
||
|
});
|