-
Notifications
You must be signed in to change notification settings - Fork 52
/
_burger.scss
122 lines (104 loc) · 3.26 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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
// Burger parts
//
// (---) top -> &::before
// [---] middle -> &
// (---) bottom -> &::after
// Vendor prefixes
$sass-burger-add-vendor-prefixes: true !default;
// Burger
@mixin burger($width: 30px, $height: 5px, $gutter: 3px, $color: #000, $border-radius: 0, $transition-duration: .3s) {
$burger-height: $height !global;
$burger-gutter: $gutter !global;
position: relative;
margin-top: $height + $gutter;
margin-bottom: $height + $gutter;
@if $sass-burger-add-vendor-prefixes {
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
}
user-select: none;
// 1. Fixes jagged edges in Firefox, see issue #10.
&, &::before, &::after {
display: block;
width: $width;
height: $height;
background-color: $color;
outline: 1px solid transparent; // 1
@if $border-radius != 0 {
border-radius: $border-radius;
}
@if $sass-burger-add-vendor-prefixes {
-webkit-transition-property: background-color, -webkit-transform;
-moz-transition-property: background-color, -moz-transform;
-o-transition-property: background-color, -o-transform;
}
transition-property: background-color, transform;
@if $sass-burger-add-vendor-prefixes {
-webkit-transition-duration: $transition-duration;
-moz-transition-duration: $transition-duration;
-o-transition-duration: $transition-duration;
}
transition-duration: $transition-duration;
}
&::before, &::after {
position: absolute;
content: "";
}
&::before {
top: -($height + $gutter);
}
&::after {
top: $height + $gutter;
}
}
// Select parts of the burger
@mixin burger-parts {
&, &::before, &::after {
@content;
}
}
@mixin burger-top {
&::before {
@content;
}
}
@mixin burger-middle {
& {
@content;
}
}
@mixin burger-bottom {
&::after {
@content;
}
}
// Burger animations
@mixin burger-to-cross($color: auto) {
& {
background-color: transparent;
}
@if ($color != auto) {
&::before, &::after {
background-color: $color;
}
}
&::before {
@if $sass-burger-add-vendor-prefixes {
-webkit-transform: translateY($burger-gutter + $burger-height) rotate(45deg);
-moz-transform: translateY($burger-gutter + $burger-height) rotate(45deg);
-ms-transform: translateY($burger-gutter + $burger-height) rotate(45deg);
-o-transform: translateY($burger-gutter + $burger-height) rotate(45deg);
}
transform: translateY($burger-gutter + $burger-height) rotate(45deg);
}
&::after {
@if $sass-burger-add-vendor-prefixes {
-webkit-transform: translateY(-($burger-gutter + $burger-height)) rotate(-45deg);
-moz-transform: translateY(-($burger-gutter + $burger-height)) rotate(-45deg);
-ms-transform: translateY(-($burger-gutter + $burger-height)) rotate(-45deg);
-o-transform: translateY(-($burger-gutter + $burger-height)) rotate(-45deg);
}
transform: translateY(-($burger-gutter + $burger-height)) rotate(-45deg);
}
}