Skip to content
Snippets Groups Projects
Commit 77288b7e authored by Ivica Puljic's avatar Ivica Puljic
Browse files

Issue #3408492 by pivica: Try to remove second-level-hover CSS class

parent 8e2a9ffa
No related branches found
No related tags found
No related merge requests found
......@@ -294,7 +294,7 @@ function bs_bootstrap_preprocess_page(&$variables) {
elseif ($navbar_onhover_overlay === 'always') {
if ($menu_item['in_active_trail']) {
// Display second level on initial page load.
$variables['navbar_wrapper_attributes']->addClass('second-level-hover');
$variables['navbar_wrapper_attributes']->addClass('second-level-expanded');
break 2;
}
}
......
......@@ -45,7 +45,7 @@
.navbar-wrapper .navbar-nav {
position: relative;
}
.navbar-wrapper.second-level-expanded::after, .navbar-wrapper.second-level-hover::after {
.navbar-wrapper.second-level-expanded::after {
position: absolute;
right: 0;
left: 0;
......
......@@ -111,6 +111,8 @@
var menuItems = [];
// Stores initial top level active menu item.
var initialActiveMenu = null;
// Does menu item already have second-level-expanded CSS class.
let hasSecondLevelExpanded = false;
// Activate menu item.
function activateMenuItem(item) {
......@@ -125,7 +127,12 @@
item.item.addClass('active show');
item.itemLink.addClass('active is-active').attr('aria-expanded', true);
$navbarWraper.addClass('second-level-hover');
if ($navbarWraper.hasClass('second-level-expanded')) {
hasSecondLevelExpanded = true;
}
else {
$navbarWraper.addClass('second-level-expanded');
}
}
// Deactivate menu item.
......@@ -138,7 +145,9 @@
item.item.removeClass('active show');
item.itemLink.removeClass('active is-active').attr('aria-expanded', false);
$navbarWraper.removeClass('second-level-hover');
if (!hasSecondLevelExpanded) {
$navbarWraper.removeClass('second-level-expanded');
}
}
// Deactivate all menu items.
......
......@@ -4,6 +4,8 @@ $navbar-second-level-height: #{$navbar-2nd-link-padding-x + $navbar-2nd-link-pad
@if breakpoint-max($navbar-collapse-responsive-break) != null {
@include media-breakpoint-up($navbar-collapse-responsive-break) {
.navbar-wrapper {
transition: all 0.05s;
// Create space and background style for second level horizontal navigation.
&.second-level-expanded {
// Claim the space for 2nd navigation line.
......@@ -23,8 +25,7 @@ $navbar-second-level-height: #{$navbar-2nd-link-padding-x + $navbar-2nd-link-pad
position: relative;
}
&.second-level-expanded,
&.second-level-hover {
&.second-level-expanded {
&::after {
position: absolute;
right: 0;
......@@ -34,7 +35,7 @@ $navbar-second-level-height: #{$navbar-2nd-link-padding-x + $navbar-2nd-link-pad
height: calc(#{$navbar-second-level-height});
content: '';
z-index: 1;
@if ($navbar-2nd-bg) {
@if ($navbar-2nd-bg != $header-bg) {
background-color: $navbar-2nd-bg;
}
@if ($navbar-2nd-border-bottom) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment