From 75a7e2131aa61bc6c1ebb7b4b143c07a57fae17c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9?= <34602360+opnsenseuser@users.noreply.github.com> Date: Wed, 10 Feb 2021 15:47:01 +0100 Subject: [PATCH] Sidebar - fix for too long a-link list (#4684) --- src/opnsense/www/js/opnsense_theme.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/opnsense/www/js/opnsense_theme.js b/src/opnsense/www/js/opnsense_theme.js index c23965f5c..7ebf8dd15 100644 --- a/src/opnsense/www/js/opnsense_theme.js +++ b/src/opnsense/www/js/opnsense_theme.js @@ -43,7 +43,8 @@ $(document).ready(function () { mainmenu = $('#mainmenu'), countA = $('#mainmenu > div > a').length, footH = $('.page-foot').height(), - headerH = $('.navbar-header').height(), + headerH = $('.navbar').height(), + li_itemH = $('a.list-group-item').height(), navHeight = (countA * 70) + ((footH + headerH) - (20 + countA)), events = { mouseenter: function () { @@ -59,8 +60,9 @@ $(document).ready(function () { var currentHeight = (divTop + divHeight); var thatTrigger = that.trigger('click'); close_submenu(this); - if (currentHeight > winHeight) { - var result = that.next('div').css('margin-top', -divHeight - (that.is(layer1_a) ? 3 : 0)); + if (currentHeight > (winHeight - li_itemH)) { + var divPos = ((divHeight - li_itemH) > divTop) ? -(((divHeight - li_itemH) - divTop)) : 3; + var viewresult = that.next('div').css('margin-top', -divHeight - (that.is(layer1_a) ? divPos : 0)); } } },