// ----------------------------------------------------------- // Site navigation desktop layout // // The main layout for the website navigation, for a desktop // devices only. // ----------------------------------------------------------- $absolute-navigation: true; $nav-desktop-background-color: $color-blue-dark; $hover-intent: .3s; $nav-links: ( 'color': $color-white, 'hover-color': $color-white, 'font-weight': 700, 'font-size': 1.6rem ); $nav-dropdown-links: ( 'color': $color-blue, 'hover-color': $color-cyan, 'font-weight': 400, 'font-size': 1.4rem ); $dropdown: ( 'gap': 1rem, 'width': 19rem ); $dropdown-toggle: ( 'background': transparent, 'border': none, 'border-radius': 50%, 'color': $color-cyan-bright, 'size': 3rem, 'arrow-size': 1rem ); $dropdown-toggle-hover: ( 'background': $color-white, 'border': 1px solid $color-white, 'color': $color-blue, ); $submenu-dropdown-toggle: ( 'background': transparent, 'border': none, 'border-radius': 0, 'color': $color-blue, 'size': 3rem, 'arrow-size': 1rem ); $submenu-dropdown-toggle-hover: ( 'background': $color-white, 'border': none, 'color': $color-blue, ); @if $absolute-navigation == true { .nav-container { background-color: transparent; position: absolute; width: 100%; // Main level links .nav-primary > ul > li > a, .nav-primary > ul > li > button { color: #fff; position: relative; } .nav-primary > ul > li > a:hover { color: #fff; } } } // Set true/false in _nav-core.sccss @if $enable-animations == true { @media only screen and (min-width: $responsivenav) { .sub-menu { width: map-get($dropdown, 'width'); visibility: hidden; opacity: 0; position: absolute; top: 100%; left: 0; transform: translateY(-2em); z-index: -1; transition: all .3s ease-in-out $hover-intent, visibility $hover-intent linear $hover-intent, z-index 0s linear .01s; @if $hover-intent == 0 { transition: all .3s ease-in-out 0s, visibility 0s linear .3s, z-index 0s linear .01s; } } .nav-primary ul .sub-menu.toggled-on { visibility: visible; opacity: 1; z-index: 1; transform: translateY(0%); transition-delay: 0s, 0s, .3s; } [data-whatinput="keyboard"] .sub-menu { transition: none; transform: none; } [data-whatinput="mouse"] .nav-primary ul .menu-item-has-children, [data-whatintent="mouse"] .nav-primary ul .menu-item-has-children { &:focus > .sub-menu, &:hover > .sub-menu { visibility: visible; opacity: 1; z-index: 1; transform: translateY(0%); transition-delay: 0s, 0s, .3s; } } // Disable animations and improve styles on IE10 + IE11 @media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) { .nav-primary .menu-items .sub-menu { width: map-get($dropdown, 'width'); visibility: visible; opacity: 1; transform: translateY(1.5rem); z-index: -1; transition: none; list-style-type: none; list-style: none; .menu-item { padding-top: 0; margin-top: 0; list-style-type: none; list-style: none; } .sub-menu.has-sub-menu { transform: translateY(0); padding-top: .5rem; } } .nav-primary ul .menu-item-has-children { &:focus > .sub-menu, &:hover > .sub-menu { visibility: visible; opacity: 1; z-index: 1; transform: translateY(0%); transition-delay: 0s, 0s, .3s; } } } } } // @if $enable-animations == true @media only screen and (min-width: $responsivenav) { .nav-container { background: $nav-desktop-background-color; } // Use display block based hovers if no animations enabled @if $enable-animations == false { // Enable hovers .nav-primary ul li:hover > ul { display: block; } // Support for non-js users .no-js .nav-primary ul li:hover > ul, .no-js .nav-primary ul li:focus > ul { display: block; } } @media only screen and (max-width: $responsivenav) { .nav-primary ul li:hover > ul { display: block; } } // Disable animations on IE10 + IE11 @media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) { // Enable hovers .nav-primary ul li:hover > ul { display: block; } } // Make sure mobile nav-toggle is hidden on desktop .nav-toggle { display: none; } // Start navigation .nav-primary { // Set based on logo height, for example air logo is about 62px // menu links height are 12px, so paddings are (60/2)-12: padding-top: 1.7rem; padding-bottom: 1.7rem; float: right; .menu-items { margin: 0; padding: 0; background: transparent; position: relative; display: flex; align-items: center; } // General menu items .menu-item { position: relative; margin: 0; // Main level a { color: map-get($nav-links, 'color'); font-size: map-get($nav-links, 'font-size'); padding: 0 2rem; font-weight: map-get($nav-links, 'font-weight'); display: inline-flex; align-items: center; min-height: map-get($dropdown-toggle, 'size'); &.disabled { color: #bbb; } // Actions in menu items &:hover, &:focus, &:active, &.highlighted, &.current { color: map-get($nav-links, 'hover-color'); } } // Dropdowns ul { position: absolute; top: 100%; right: 0; width: map-get($dropdown, 'width'); background: #fff; margin-left: 0; padding-bottom: .5rem; padding-top: .5rem; padding-left: 0; margin-top: map-get($dropdown, 'gap'); z-index: 999; &.sub-menu { padding-left: 0; padding-top: .5rem; padding-bottom: .5rem; } &.sub-menu li { margin: 0; } li { float: none; width: map-get($dropdown, 'width'); padding: 0; } ul { top: 0; left: 100%; margin-left: 0; margin-top: -5px; } a { padding: .8rem 1.5rem; font-size: map-get($nav-dropdown-links, 'font-size'); font-weight: map-get($nav-dropdown-links, 'font-weight'); color: map-get($nav-dropdown-links, 'color'); display: block; } a:hover, a:focus, a:active, a.highlighted { color: map-get($nav-dropdown-links, 'hover-color'); } .disabled { background: #fff; color: #ccc; } } // Sub-level toggle arrow ul li .dropdown-toggle { background-color: map-get($submenu-dropdown-toggle, 'background'); border: map-get($submenu-dropdown-toggle, 'border'); border-radius: map-get($submenu-dropdown-toggle, 'border-radius'); color: map-get($submenu-dropdown-toggle, 'color'); height: map-get($submenu-dropdown-toggle, 'size'); width: map-get($submenu-dropdown-toggle, 'size'); flex-shrink: 0; &:hover, &:active { background-color: map-get($submenu-dropdown-toggle, 'background'); border: map-get($submenu-dropdown-toggle, 'border'); color: map-get($submenu-dropdown-toggle, 'color'); } svg { transform: rotate(-90deg) rotateX(0deg); width: map-get($submenu-dropdown-toggle, 'arrow-size'); height: map-get($submenu-dropdown-toggle, 'arrow-size'); } &.toggled-on svg { transform: rotate(-90deg) rotateX(180deg); } } // Main level toggle arrow button.dropdown-toggle { background-color: map-get($dropdown-toggle, 'background'); border: map-get($dropdown-toggle, 'border'); border-radius: map-get($dropdown-toggle, 'border-radius'); color: map-get($dropdown-toggle, 'color'); height: map-get($dropdown-toggle, 'size'); width: map-get($dropdown-toggle, 'size'); padding: 0; display: inline-flex; align-items: center; justify-content: center; svg { transition: transform .3s ease-in; width: map-get($dropdown-toggle, 'arrow-size'); height: map-get($dropdown-toggle, 'arrow-size'); } &:hover, &:active { background-color: map-get($dropdown-toggle-hover, 'background'); border: map-get($dropdown-toggle-hover, 'border'); color: map-get($dropdown-toggle-hover, 'color'); } &.toggled-on svg { transform: rotateX(180deg); } } // Bubble arrow > li > ul:after { content: ''; position: absolute; width: 0; height: 0; overflow: hidden; border-style: dashed dashed solid; top: -16px; left: 31px; border-width: 8px; border-color: transparent transparent #fff; } } // Prevent nav from flickering .menu-item.menu-item-has-children { margin-right: .8rem; position: relative; display: flex; justify-content: space-between; // Add a pseudo element to fill the gap // between menu item and sub menu to help hovering &:after { display: block; position: absolute; content: ''; height: map-get($dropdown, 'gap'); width: 100%; top: 100%; } > a { // Let's make space for the nav-toggle/arrow padding-right: 1.5rem; } } // .menu-item.menu-item-has-children .sub-menu .menu-item-has-children { // Don't use gap filler in sub menu items &:after { display: none; } } } } // @media only screen and (min-width: $responsivenav)