mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-09 23:45:45 +01:00
fixed menu "active" state
This commit is contained in:
@@ -37,7 +37,6 @@ var ajaxify = {};
|
|||||||
|
|
||||||
if (ajaxify.go(url)) {
|
if (ajaxify.go(url)) {
|
||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,22 @@
|
|||||||
|
|
||||||
</div><!--END container -->
|
</div><!--END container -->
|
||||||
|
<script>
|
||||||
|
(function() {
|
||||||
|
// On menu click, change "active" state
|
||||||
|
var menuEl = document.querySelector('.nav'),
|
||||||
|
liEls = menuEl.querySelectorAll('li'),
|
||||||
|
parentEl;
|
||||||
|
|
||||||
|
menuEl.addEventListener('click', function(e) {
|
||||||
|
parentEl = e.target.parentNode;
|
||||||
|
if (parentEl.nodeName === 'LI') {
|
||||||
|
for(var x=0,numLis=liEls.length;x<numLis;x++) {
|
||||||
|
if (liEls[x] !== parentEl) liEls[x].className = '';
|
||||||
|
else parentEl.className = 'active';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, false);
|
||||||
|
})();
|
||||||
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
Reference in New Issue
Block a user