| |
@@ -28,8 +28,16 @@
|
| |
menuState.expandedItems = getExpandedItems()
|
| |
saveNavState()
|
| |
})
|
| |
+ var navItemSpan = findNextElement(btn, '.nav-text')
|
| |
+ if (navItemSpan) {
|
| |
+ navItemSpan.style.cursor = 'pointer'
|
| |
+ navItemSpan.addEventListener('click', function () {
|
| |
+ li.classList.toggle('is-active')
|
| |
+ menuState.expandedItems = getExpandedItems()
|
| |
+ saveNavState()
|
| |
+ })
|
| |
+ }
|
| |
})
|
| |
-
|
| |
find('.nav-item', menuPanel).forEach(function (item, idx) {
|
| |
item.setAttribute('data-id', 'menu-' + item.dataset.depth + '-' + idx)
|
| |
})
|
| |
@@ -143,4 +151,14 @@
|
| |
function find (selector, from) {
|
| |
return [].slice.call((from || document).querySelectorAll(selector))
|
| |
}
|
| |
+ function findNextElement (from, selector) {
|
| |
+ var el
|
| |
+ if ('nextElementSibling' in from) {
|
| |
+ el = from.nextElementSibling
|
| |
+ } else {
|
| |
+ el = from
|
| |
+ while ((el = el.nextSibling) && el.nodeType !== 1);
|
| |
+ }
|
| |
+ return el && selector ? el[el.matches ? 'matches' : 'msMatchesSelector'](selector) && el : el
|
| |
+ }
|
| |
})()
|
| |
This pull request made the changes;
- If an item in the navigation tree is not a link, but it has child items, that item should be expanded when clicked
Signed off by Oyelakin Mercy oyelakinmercy68@gmail.com