From 33ce263838f60dc6401e9448f5332eaad49b770b Mon Sep 17 00:00:00 2001 From: Piero Toffanin Date: Tue, 19 Mar 2019 18:25:12 -0400 Subject: [PATCH] Fixed menu quirks --- app/static/app/css/theme.scss | 7 ++++++- app/templates/app/base.html | 14 ++++++++------ 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/app/static/app/css/theme.scss b/app/static/app/css/theme.scss index ced9f00c..5532a265 100644 --- a/app/static/app/css/theme.scss +++ b/app/static/app/css/theme.scss @@ -81,7 +81,12 @@ a, a:hover, a:focus{ } } -#navbar-top ul#side-menu a:hover, #navbar-top ul#side-menu a:focus{ +#navbar-top ul#side-menu a:focus{ + background-color: inherit; + color: inherit; +} + +#navbar-top ul#side-menu a:hover, #navbar-top ul#side-menu a.active:hover{ background-color: theme("button_primary"); color: theme("secondary"); } diff --git a/app/templates/app/base.html b/app/templates/app/base.html index 38021d2b..6f824fc2 100644 --- a/app/templates/app/base.html +++ b/app/templates/app/base.html @@ -94,8 +94,8 @@ $(function(){ $('#side-menu').metisMenu(); $(window).bind("load resize", function() { - let topOffset = 50; - let width = (this.window.innerWidth > 0) ? this.window.innerWidth : this.screen.width; + var topOffset = 50; + var width = (this.window.innerWidth > 0) ? this.window.innerWidth : this.screen.width; if (width < 768) { $('div.navbar-collapse').addClass('collapse'); topOffset = 100; // 2-row-menu @@ -103,7 +103,7 @@ $(function(){ $('div.navbar-collapse').removeClass('collapse'); } - let height = ((this.window.innerHeight > 0) ? this.window.innerHeight : this.screen.height) - 1; + var height = ((this.window.innerHeight > 0) ? this.window.innerHeight : this.screen.height) - 1; height = height - topOffset; if (height < 1) height = 1; if (height > topOffset) { @@ -111,18 +111,20 @@ $(function(){ } }); - let url = window.location; - let element = $('ul.nav a').filter(function() { + var url = window.location; + var element = $('ul.nav a').filter(function() { return this.href == url; }).addClass('active').parent(); while(true){ if (element.is('li')){ - element = element.parent().addClass('in').parent(); + element = element.parent().addClass('in'); } else { break; } } + + if (element.parent().is('li')) element.parent().addClass('active'); });