scss/foundation/components/_top-bar.scss in zurb-foundation-4.1.6 vs scss/foundation/components/_top-bar.scss in zurb-foundation-4.2.0
- old
+ new
@@ -1,61 +1,79 @@
//
// Top Bar Variables
//
-$include-html-nav-classes: $include-html-classes !default;
+$include-html-top-bar-classes: $include-html-classes !default;
// Background color for the top bar
-$topbar-bg: #111 !default;
+$topbar-bg: #111 !default;
// Height and margin
-$topbar-height: 45px !default;
-$topbar-margin-bottom: emCalc(30px) !default;
+$topbar-height: 45px !default;
+$topbar-margin-bottom: emCalc(30px) !default;
// Control Input height for top bar
-$topbar-input-height: 2.45em !default;
+$topbar-input-height: 2.45em !default;
// Controlling the styles for the title in the top bar
-$topbar-title-weight: bold !default;
-$topbar-title-font-size: emCalc(17px) !default;
+$topbar-title-weight: bold !default;
+$topbar-title-font-size: emCalc(17px) !default;
+// Style the top bar dropdown elements
+$topbar-dropdown-bg: #222 !default;
+$topbar-dropdown-link-color: #fff !default;
+$topbar-dropdown-link-bg: lighten($topbar-bg, 5%) !default;
+$topbar-dropdown-toggle-size: 5px !default;
+$topbar-dropdown-toggle-color: #fff !default;
+$topbar-dropdown-toggle-alpha: 0.5 !default;
+
// Set the link colors and styles for top-level nav
-$topbar-link-color: #fff !default;
-$topbar-link-weight: bold !default;
-$topbar-link-font-size: emCalc(13px) !default;
-$topbar-link-hover-lightness: -30% !default; // Darken by 30%
+$topbar-link-color: #fff !default;
+$topbar-link-color-hover: #fff !default;
+$topbar-link-color-active: #fff !default;
+$topbar-link-weight: bold !default;
+$topbar-link-font-size: emCalc(13px) !default;
+$topbar-link-hover-lightness: -30% !default; // Darken by 30%
+$topbar-link-bg-hover: darken($topbar-bg, 3%) !default;
+$topbar-link-bg-active: darken($topbar-bg, 3%) !default;
-// Style the top bar dropdown elements
-$topbar-dropdown-bg: #333 !default;
-$topbar-dropdown-link-color: #fff !default;
-$topbar-dropdown-toggle-size: 5px !default;
-$topbar-dropdown-toggle-color: #fff !default;
-$topbar-dropdown-toggle-alpha: 0.5 !default;
-$dropdown-label-color: #555 !default;
+$topbar-dropdown-label-color: #555 !default;
+$topbar-dropdown-label-text-transform: uppercase !default;
+$topbar-dropdown-label-font-weight: bold !default;
+$topbar-dropdown-label-font-size: emCalc(10px) !default;
// Top menu icon styles
-$topbar-menu-link-transform: uppercase !default;
-$topbar-menu-link-font-size: emCalc(13px) !default;
-$topbar-menu-link-weight: bold !default;
-$topbar-menu-link-color: #fff !default;
-$topbar-menu-icon-color: #fff !default;
-$topbar-menu-link-color-toggled: #888 !default;
-$topbar-menu-icon-color-toggled: #888 !default;
+$topbar-menu-link-transform: uppercase !default;
+$topbar-menu-link-font-size: emCalc(13px) !default;
+$topbar-menu-link-weight: bold !default;
+$topbar-menu-link-color: #fff !default;
+$topbar-menu-icon-color: #fff !default;
+$topbar-menu-link-color-toggled: #888 !default;
+$topbar-menu-icon-color-toggled: #888 !default;
// Transitions and breakpoint styles
-$topbar-transition-speed: 300ms !default;
-$topbar-breakpoint: emCalc(940px) !default; // Change to 9999px for always mobile layout
-$topbar-media-query: "only screen and (min-width:"#{$topbar-breakpoint}")" !default;
+$topbar-transition-speed: 300ms !default;
+$topbar-breakpoint: emCalc(940px) !default; // Change to 9999px for always mobile layout
+$topbar-media-query: "only screen and (min-width: #{$topbar-breakpoint})" !default;
-@if $include-html-nav-classes {
+// Divider Styles
+$topbar-divider-border-bottom: solid 1px lighten($topbar-bg, 10%) !default;
+$topbar-divider-border-top: solid 1px darken($topbar-bg, 10%) !default;
+// Sticky Class
+$topbar-sticky-class: ".sticky" !default;
+
+@if $include-html-top-bar-classes != false {
+
/* Wrapped around .top-bar to contain to grid width */
.contain-to-grid {
width: 100%;
background: $topbar-bg;
+
+ .top-bar { margin-bottom: 0; }
}
- // Wrapped around .top-bar to make it fixed at the top
+ // Wrapped around .top-bar to make it stick to the top
.fixed {
width: 100%;
#{$default-float}: 0;
position: fixed;
top: 0;
@@ -84,11 +102,14 @@
input { height: $topbar-input-height; }
.button { padding-top: .5em; padding-bottom: .5em; margin-bottom: 0; }
// Title Area
- .title-area { position: relative; }
+ .title-area {
+ position: relative;
+ margin: 0;
+ }
.name {
height: $topbar-height;
margin: 0;
font-size: $em-base;
@@ -145,14 +166,15 @@
#{$opposite-direction}: 0;
display: block;
width: 16px;
height: 0;
// Shh, don't tell, but box-shadows create the menu icon :)
- -webkit-box-shadow: 0 10px 0 1px $topbar-menu-icon-color,
- 0 16px 0 1px $topbar-menu-icon-color,
- 0 22px 0 1px $topbar-menu-icon-color;
-
+ @if $experimental {
+ -webkit-box-shadow: 0 10px 0 1px $topbar-menu-icon-color,
+ 0 16px 0 1px $topbar-menu-icon-color,
+ 0 22px 0 1px $topbar-menu-icon-color;
+ }
box-shadow: 0 10px 0 1px $topbar-menu-icon-color,
0 16px 0 1px $topbar-menu-icon-color,
0 22px 0 1px $topbar-menu-icon-color;
}
}
@@ -168,14 +190,15 @@
.toggle-topbar {
a { color: $topbar-menu-link-color-toggled;
span {
// Shh, don't tell, but box-shadows create the menu icon :)
- -webkit-box-shadow: 0 10px 0 1px $topbar-menu-icon-color-toggled,
- 0 16px 0 1px $topbar-menu-icon-color-toggled,
- 0 22px 0 1px $topbar-menu-icon-color-toggled;
-
+ @if $experimental {
+ -webkit-box-shadow: 0 10px 0 1px $topbar-menu-icon-color-toggled,
+ 0 16px 0 1px $topbar-menu-icon-color-toggled,
+ 0 22px 0 1px $topbar-menu-icon-color-toggled;
+ }
box-shadow: 0 10px 0 1px $topbar-menu-icon-color-toggled,
0 16px 0 1px $topbar-menu-icon-color-toggled,
0 22px 0 1px $topbar-menu-icon-color-toggled;
}
}
@@ -193,19 +216,19 @@
ul {
width: 100%;
height: auto;
display: block;
- background: $topbar-dropdown-bg;
+ background: $topbar-bg;
font-size: $em-base;
margin: 0;
}
.divider,
[role="separator"] {
- border-bottom: solid 1px lighten($topbar-dropdown-bg, 10%);
- border-top: solid 1px darken($topbar-dropdown-bg, 10%);
+ border-bottom: $topbar-divider-border-bottom;
+ border-top: $topbar-divider-border-top;
clear: both;
height: 1px;
width: 100%;
}
@@ -218,43 +241,49 @@
padding-#{$default-float}: $topbar-height / 3;
font-size: $topbar-link-font-size;
font-weight: $topbar-link-weight;
background: $topbar-dropdown-bg;
- &:hover { background: darken($topbar-dropdown-bg, 3%); }
+ &.hover {
+ background: $topbar-link-bg-hover;
+ color: $topbar-link-color-hover;
+ }
&.button {
background: $primary-color;
font-size: $topbar-link-font-size;
- &:hover {
+ &.hover {
background: darken($primary-color, 10%);
}
}
&.button.secondary {
background: $secondary-color;
- &:hover {
+ &.hover {
background: darken($secondary-color, 10%);
}
}
&.button.success {
background: $success-color;
- &:hover {
+ &.hover {
background: darken($success-color, 10%);
}
}
&.button.alert {
background: $alert-color;
- &:hover {
+ &.hover {
background: darken($alert-color, 10%);
}
}
}
// Apply the active link color when it has that class
- &.active > a { background: darken($topbar-dropdown-bg, 3%); }
+ &.active > a {
+ background: $topbar-link-bg-active;
+ color: $topbar-link-color-active;
+ }
}
// Add some extra padding for list items contains buttons
.has-form { padding: $topbar-height / 3; }
@@ -266,11 +295,11 @@
&:after {
@include css-triangle($topbar-dropdown-toggle-size, rgba($topbar-dropdown-toggle-color, $topbar-dropdown-toggle-alpha), $default-float);
margin-#{$opposite-direction}: $topbar-height / 3;
margin-top: -($topbar-dropdown-toggle-size / 2) - 2;
position: absolute;
- top: 22px;
+ top: 50%;
#{$opposite-direction}: 0;
}
}
&.moved { position: static;
@@ -286,11 +315,14 @@
#{$default-float}: 100%;
top: 0;
visibility: hidden;
z-index: 99;
- li { width: 100%;
+ li {
+ width: 100%;
+ height: auto;
+
a {
font-weight: normal;
padding: 8px $topbar-height / 3;
}
@@ -304,14 +336,14 @@
}
label {
padding: 8px $topbar-height / 3 2px;
margin-bottom: 0;
- text-transform: uppercase;
- color: $dropdown-label-color;
- font-weight: bold;
- font-size: emCalc(10px);
+ text-transform: $topbar-dropdown-label-text-transform;
+ color: $topbar-dropdown-label-color;
+ font-weight: $topbar-dropdown-label-font-weight;
+ font-size: $topbar-dropdown-label-font-size;
}
}
}
// Element that controls breakpoint, no need to change this ever
@@ -322,11 +354,15 @@
.js-generated { display: block; }
// Top Bar styles intended for screen sizes above the breakpoint.
@media #{$topbar-media-query} {
- .top-bar { background: $topbar-bg; @include clearfix; overflow: visible;
+ .top-bar {
+ background: $topbar-bg;
+ @include clearfix;
+ overflow: visible;
+
.toggle-topbar { display: none; }
.title-area { float: $default-float; }
.name h1 a { width: auto; }
@@ -341,11 +377,14 @@
}
&.expanded { background: $topbar-bg; }
}
- .contain-to-grid .top-bar { max-width: $row-width; margin: 0 auto; margin-bottom: $topbar-margin-bottom; }
+ .contain-to-grid .top-bar {
+ max-width: $row-width;
+ margin: 0 auto;
+ }
.top-bar-section {
@include single-transition(none,0,0);
#{$default-float}: 0 !important;
@@ -363,11 +402,11 @@
li {
a:not(.button) {
padding: 0 $topbar-height / 3;
line-height: $topbar-height;
background: $topbar-bg;
- &:hover { background: adjust-color($topbar-dropdown-bg, $lightness: $topbar-link-hover-lightness); }
+ &.hover { background: adjust-color($topbar-dropdown-bg, $lightness: $topbar-link-hover-lightness); }
}
}
.has-dropdown {
& > a {
@@ -382,23 +421,22 @@
&.moved { position: relative;
& > .dropdown { visibility: hidden; }
}
- &:hover,
- &:active {
+ &.hover {
& > .dropdown {
visibility: visible;
}
}
.dropdown li.has-dropdown {
& > a {
&:after {
border: none;
content: "\00bb";
- margin-top: -15px;
+ margin-top: -16px;
#{$opposite-direction}: 5px;
}
}
}
@@ -414,11 +452,11 @@
a {
color: $topbar-dropdown-link-color;
line-height: 1;
white-space: nowrap;
padding: 7px $topbar-height / 3;
- background: lighten($topbar-bg, 5%);
+ background: $topbar-dropdown-link-bg;
}
label {
white-space: nowrap;
background: lighten($topbar-bg, 5%);
@@ -434,11 +472,11 @@
& > ul > .divider,
& > ul > [role="separator"] {
border-bottom: none;
border-top: none;
- border-#{$opposite-direction}: solid 1px lighten($topbar-bg, 10%);
- border-#{$default-float}: solid 1px darken($topbar-bg, 10%);
+ border-#{$opposite-direction}: $topbar-divider-border-bottom;
+ border-#{$default-float}: $topbar-divider-border-top;
clear: none;
height: $topbar-height;
width: 0px;
}