Skip to content

Node.js based forum software built for the modern web

fixed menu "active" state

Julian Lam96a4cbd8d113
diff --git a/public/src/ajaxify.js b/public/src/ajaxify.js
index a1446dedc7..17a64a6563 100644
--- a/public/src/ajaxify.js
+++ b/public/src/ajaxify.js
@@ -37,7 +37,6 @@ var ajaxify = {};
if (ajaxify.go(url)) {
ev.preventDefault();
- return false;
}
}
diff --git a/public/templates/footer.tpl b/public/templates/footer.tpl
index 4e2b13df84..559db431c6 100644
--- a/public/templates/footer.tpl
+++ b/public/templates/footer.tpl
@@ -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>
</html>
\ No newline at end of file