From 7034b3c908e96e3e26aaa66299b75290adc98f02 Mon Sep 17 00:00:00 2001 From: kimsible Date: Mon, 10 Aug 2020 23:28:31 +0200 Subject: Refactor - improve offset content handling with fixed sub-menu and broadcast-message --- client/src/sass/application.scss | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) (limited to 'client/src/sass') diff --git a/client/src/sass/application.scss b/client/src/sass/application.scss index 946647ccb..3722348a0 100644 --- a/client/src/sass/application.scss +++ b/client/src/sass/application.scss @@ -138,10 +138,6 @@ label { flex-grow: 1; } - my-top-menu-dropdown + .margin-content { - padding-top: $sub-menu-height + $sub-menu-margin-bottom; - } - .sub-menu { background-color: pvar(--submenuColor); width: 100%; @@ -149,22 +145,20 @@ label { align-items: center; padding-left: $not-expanded-horizontal-margins; padding-right: $not-expanded-horizontal-margins; - - & + .margin-content { - padding-top: $sub-menu-margin-bottom; - } + height: $sub-menu-height; + margin-bottom: $sub-menu-margin-bottom; &.sub-menu-fixed { - height: $sub-menu-height; position: fixed; z-index: #{z('header') - 1}; - - & + .margin-content { - padding-top: $sub-menu-height + $sub-menu-margin-bottom; - } } } + // Use an appropriate offset top when sub-menu fixed + .margin-content.offset-content { + padding-top: $sub-menu-height + $sub-menu-margin-bottom; + } + // Override some properties if the main content is expanded (no menu on the left) &.expanded { margin-left: 0; @@ -305,9 +299,17 @@ table { } } +/* offsetTop for scrollToAnchor */ + .anchor { position: relative; - top: #{-($header-height + 20px)}; // offsetTop scrollToAnchor + top: #{-($header-height + 20px)}; +} + +.offset-content { // if sub-menu fixed + .anchor { + top: #{-($header-height + $sub-menu-height + 20px)}; + } } @media screen and (max-width: #{breakpoint(xxl)}) { @@ -363,6 +365,11 @@ table { overflow-x: auto; } + // Use an appropriate offset top when sub-menu fixed + .margin-content.offset-content { + padding-top: $sub-menu-height + $sub-menu-margin-bottom-small-view; + } + .admin-sub-header { @include admin-sub-header-responsive(15px*2); } -- cgit v1.2.3