-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path_burger.scss
108 lines (88 loc) · 2 KB
/
_burger.scss
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
$burger-width: 28px !default;
$burger-height: 22px !default;
$burger-padding: 4px !default;
$burger-line-height: 4px !default;
$burger-line-color: #666 !default;
$burger-line-rounded: true !default;
$burger-animate: true !default;
$burger-transition: .2s ease-out !default;
$burger-rotation: 1 !default;
$burger-font-family: sans-serif !default;
$burger-font-size: 0.7em !default;
$burger-letter-spacing: 0px !default;
$burger-translate-y: ( $burger-height - $burger-line-height ) / 2;
$burger-rotate: 45deg + ( 180deg * ( $burger-rotation - 1 ) );
//
// Burger icon that can animate to a close icon
//
// .burger__line = middle line
// :before = top line
// :after = bottom line
//
.burger {
cursor: pointer;
display: inline-block;
height: $burger-height + $burger-padding * 2;
outline: 0;
position: relative;
width: $burger-width + $burger-padding * 2;
&:focus {
outline: 0;
}
.burger__line,
&:before,
&:after {
background-color: $burger-line-color;
display: block;
height: $burger-line-height;
left: $burger-padding;
position: absolute;
transition: all $burger-transition;
width: $burger-width;
@if ( $burger-line-rounded ) {
border-radius: $burger-line-height / 2;
}
}
.burger__line {
margin-top: -$burger-line-height / 2; // Center the middle line
opacity: 1;
top: 50%;
}
&:before,
&:after {
content: ' ';
}
&:before {
top: $burger-padding;
}
&:after {
bottom: $burger-padding;
}
}
.burger--has-text {
margin-bottom: $burger-font-size;
.burger__text {
font-family: $burger-font-family;
font-size: $burger-font-size;
left: 50%;
letter-spacing: $burger-letter-spacing;
line-height: 1;
position: absolute;
top: 100%;
transform: translate( -50%, 0 );
color: $burger-line-color;
}
}
@if ( $burger-animate ) {
.burger.is-on {
.burger__line {
opacity: 0;
}
&:before {
transform: translateY( $burger-translate-y ) rotate( -$burger-rotate );
}
&:after {
transform: translateY( -$burger-translate-y ) rotate( $burger-rotate );
}
}
}