Menü
document.addEventListener('DOMContentLoaded', function() {
var ticketButton = document.querySelector('.custom-ticket-menu .menu-item.menu-item-has-children > a');
var dropdownMenu = document.querySelector('.custom-ticket-menu .menu-item.menu-item-has-children .sub-menu');
// Toggle-Funktion für den Ticket-Button
if (ticketButton) {
ticketButton.addEventListener('click', function(event) {
event.preventDefault();
this.classList.toggle('active');
if (dropdownMenu.style.display === "block") {
dropdownMenu.style.display = "none";
} else {
dropdownMenu.style.display = "block";
}
});
}
// Sicherstellen, dass das Dropdown-Menü bei Klick außerhalb geschlossen wird
document.addEventListener('click', function(event) {
if (!ticketButton.contains(event.target) && !dropdownMenu.contains(event.target)) {
dropdownMenu.style.display = "none";
ticketButton.classList.remove('active');
}
});
});