Skip to content

Commit ca28179

Browse files
committed
Fix top level Menu UI functionality
1 parent 722221c commit ca28179

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

src/js/01-nav.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,9 +156,26 @@
156156
var otherNavs = document.querySelectorAll('.nav-list > .nav-item[data-depth="0"]')
157157
otherNavs.forEach(function (nav) {
158158
var navSubMenu = Array.from(nav.querySelector('ul.nav-list').children)
159+
// var navDataDepth = Array.from(nav.querySelector('ul.nav-list'))
159160
navSubMenu.forEach(function (item) {
160161
item.classList.remove('is-inactive')
161162
})
163+
164+
// hide main menu for top level navigation -
165+
166+
if (nav.className.includes('is-current-page')) {
167+
navMenuControl.style.display = 'none'
168+
console.log(navMenuControl)
169+
}
170+
171+
// hide in second level menu
172+
if (nav.className.includes('is-current-path')) {
173+
otherNavs.forEach(function (navItem) {
174+
if (!navItem.className.includes('is-current-path')) {
175+
navItem.classList.add('is-inactive')
176+
}
177+
})
178+
}
162179
})
163180
// if(otherNavs) {
164181

src/partials/nav-tree.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
{{#each navigation}}
33
{{#if (eq ../crumbAtLevel this)}}
44
{{#if ( eq ../crumbLevel 0 or eq ../crumbLevel 1 or eq ../crumbLevel 2 or eq ../crumbLevel 3)}}
5-
<div class="main-nav-parent new ">
5+
<div class="main-nav-parent new " data-depth="{{../level}}">
66
<span class="back-to-menu"><i class="fas fa-chevron-left"></i> Main Menu </span>
77
{{!-- <span class="nav-text">{{{./content}}}</span> --}}
88
</div>

0 commit comments

Comments
 (0)