summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/js/01-navigation.js20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/js/01-navigation.js b/src/js/01-navigation.js
index 3272cf9..29e8e1e 100644
--- a/src/js/01-navigation.js
+++ b/src/js/01-navigation.js
@@ -28,6 +28,15 @@
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) {
@@ -143,4 +152,15 @@
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
+ }
})()