UNPKG

3.47 kBSCSSView Raw
1// Foundation for Sites by ZURB
2// foundation.zurb.com
3// Licensed under MIT Open Source
4
5////
6/// @group drilldown
7////
8
9/// Transition property to use for animating menus.
10/// @type Transition
11$drilldown-transition: transform 0.15s linear !default;
12
13/// Adds arrows to drilldown items with submenus, as well as the back button.
14/// @type Boolean
15$drilldown-arrows: true !default;
16
17/// Sets drilldown menu item padding.
18/// @type Number
19$drilldown-padding: $global-menu-padding !default;
20
21/// Sets drilldown menu nested margin
22/// @type Number
23$drilldown-nested-margin: 0 !default;
24
25/// Background color for drilldown top level items.
26/// @type Color
27$drilldown-background: $white !default;
28
29/// Sets drilldown menu item padding in the submenu.
30/// @type Number
31$drilldown-submenu-padding: $drilldown-padding !default;
32
33/// Background color for drilldown submenus.
34/// @type Color
35$drilldown-submenu-background: $white !default;
36
37/// Sets drilldown arrow color if arrow is used.
38/// @type Color
39$drilldown-arrow-color: $primary-color !default;
40
41/// Sets drilldown arrow size if arrow is used.
42/// @type Length
43$drilldown-arrow-size: 6px !default;
44
45@mixin zf-drilldown-left-right-arrows {
46 .is-drilldown-submenu-parent > a {
47 position: relative;
48 &::after {
49 position: absolute;
50 top: 50%;
51 margin-top: -1 * $drilldown-arrow-size;
52 #{$global-right}: 1rem;
53 @include css-triangle($drilldown-arrow-size, $drilldown-arrow-color, $global-right);
54 }
55 }
56
57 &.align-left .is-drilldown-submenu-parent > a::after {
58 left: auto;
59 right: 1rem;
60 @include css-triangle($dropdownmenu-arrow-size, $dropdownmenu-arrow-color, right);
61 }
62
63 &.align-right .is-drilldown-submenu-parent > a::after {
64 right: auto;
65 left: 1rem;
66 @include css-triangle($dropdownmenu-arrow-size, $dropdownmenu-arrow-color, left);
67 }
68
69}
70
71@mixin foundation-drilldown-menu {
72 // Applied to the Menu container
73 .is-drilldown {
74 position: relative;
75 overflow: hidden;
76
77 li {
78 display: block;
79 }
80
81 &.animate-height {
82 transition: height 0.5s;
83 }
84 }
85
86 // The top level <ul>
87 .drilldown {
88 a {
89 padding: $drilldown-padding;
90 background: $drilldown-background;
91 }
92
93 // Applied to submenu <ul>s
94 .is-drilldown-submenu {
95 position: absolute;
96 top: 0;
97 #{$global-left}: 100%;
98 z-index: -1;
99
100 width: 100%;
101 background: $drilldown-submenu-background;
102 transition: $drilldown-transition;
103
104 &.is-active {
105 z-index: 1;
106 display: block;
107 transform: translateX(if($global-text-direction == ltr, -100%, 100%));
108 }
109
110 &.is-closing {
111 transform: translateX(if($global-text-direction == ltr, 100%, -100%));
112 }
113
114 // Submenu item padding
115 a {
116 padding: $drilldown-submenu-padding;
117 }
118 }
119
120 .nested.is-drilldown-submenu {
121 @include menu-nested($drilldown-nested-margin);
122 }
123
124 .drilldown-submenu-cover-previous {
125 min-height: 100%;
126 }
127
128 @if $drilldown-arrows {
129 @include zf-drilldown-left-right-arrows;
130
131 .js-drilldown-back > a::before {
132 @include css-triangle($drilldown-arrow-size, $drilldown-arrow-color, $global-left);
133 border-#{$global-left}-width: 0;
134 display: inline-block;
135 vertical-align: middle;
136 margin-#{$global-right}: 0.75rem; // Creates space between the arrow and the text
137
138 border-#{$global-left}-width: 0;
139 }
140 }
141 }
142}