From 46da9b91e786c5ea15dca7b9e1814e26d6f718cb Mon Sep 17 00:00:00 2001 From: billz Date: Thu, 24 Oct 2019 22:23:57 +0100 Subject: [PATCH] Adds active class to current nav-item --- app/js/custom.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/app/js/custom.js b/app/js/custom.js index 400cfe0f..df505046 100644 --- a/app/js/custom.js +++ b/app/js/custom.js @@ -277,7 +277,15 @@ $(window).resize(function() { $('.sidebar').removeClass('d-none'); $('.sidebar').removeClass('toggled'); }; - }); +}); + +// Adds active class to current nav-item +$(window).bind("load", function() { + var url = window.location; + $('ul.navbar-nav a').filter(function() { + return this.href == url; + }).parent().addClass('active'); +}); $(document) .ajaxSend(setCSRFTokenHeader)