From 962035323fb270ea6a27da68ad993184a5425abe Mon Sep 17 00:00:00 2001 From: Filip Gralinski Date: Sat, 5 Oct 2019 18:47:07 +0200 Subject: [PATCH] Active element in the top menu is marked --- static/js/extra.js | 9 +++++++++ templates/default-layout-wrapper.hamlet | 1 + templates/default-layout.hamlet | 2 +- 3 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 static/js/extra.js diff --git a/static/js/extra.js b/static/js/extra.js new file mode 100644 index 0000000..243b0bd --- /dev/null +++ b/static/js/extra.js @@ -0,0 +1,9 @@ +$(document).ready(function () { + var url = window.location; + $('.navbar-top').find('.active').removeClass('active'); + $('.navbar-top li a').each(function () { + if (this.href == url) { + $(this).parent().addClass('active'); + } + }); + }); diff --git a/templates/default-layout-wrapper.hamlet b/templates/default-layout-wrapper.hamlet index f1a65bd..37a94f5 100644 --- a/templates/default-layout-wrapper.hamlet +++ b/templates/default-layout-wrapper.hamlet @@ -23,6 +23,7 @@ $newline never