diff --git a/assets/css/style.css b/assets/css/style.css index d8ac037..885f3be 100644 --- a/assets/css/style.css +++ b/assets/css/style.css @@ -129,12 +129,12 @@ body { text-decoration: underline; } -.primary_nav__sub_navlist { +.primary_nav__sub_navlist.-closed { display: none; z-index: 20; } -.primary_nav__navlist > li:hover > .primary_nav__sub_navlist { +.primary_nav__sub_navlist.-open { display: block; margin: 2.6rem 0 0 -0.5rem; padding: 0; diff --git a/assets/js/nav_toggle.js b/assets/js/nav_toggle.js index 3cd58cf..9242ba1 100644 --- a/assets/js/nav_toggle.js +++ b/assets/js/nav_toggle.js @@ -6,3 +6,17 @@ document.getElementsByClassName('primary_nav__toggle')[0].addEventListener('clic nav_list.style.display = 'block'; } }); + +let primary_menu_items = document.getElementsByClassName('primary_nav__navitem'); +for (let i = 0; i < primary_menu_items.length; i++) { + primary_menu_items[i].addEventListener('click', function(event) { + let dropdown = event.currentTarget.firstElementChild; + if (dropdown.classList.contains('-closed')) { + dropdown.classList.remove('-closed'); + dropdown.classList.add('-open'); + } else { + dropdown.classList.remove('-open'); + dropdown.classList.add('-closed'); + } + }); +} diff --git a/databags/navigation.json b/databags/navigation.json index 292ce51..2f6346b 100644 --- a/databags/navigation.json +++ b/databags/navigation.json @@ -1,6 +1,7 @@ { "Was wir tun": { "href": "/about", + "slug": "about", "visible": true, "list_childs": false, "items": { @@ -9,6 +10,7 @@ }, "Was geht ab?": { "href": "/aktuelles", + "slug": "aktuelles", "visible": true, "list_childs": false, "items": { @@ -18,8 +20,9 @@ }, "Mitglied werden": { "href": "/mitglieder", + "slug": "mitglieder", "visible": true, - "list_childs": false, + "list_childs": true, "items": { "Satzung": "/mitglieder/satzung", "Mitglied werden": "/mitglieder/beitreten" diff --git a/templates/blocks/navigation.html b/templates/blocks/navigation.html index 969eca9..4ef61d9 100644 --- a/templates/blocks/navigation.html +++ b/templates/blocks/navigation.html @@ -12,16 +12,19 @@