blob: 4c0faea15b567f631a9618aedeb085255ff1b9e7 [file] [log] [blame]
Michael Davis5a752b22017-03-09 09:41:08 -06001@mixin marginTransition {
2 -webkit-transition: margin 0.4s, background 0.4s;
3 -moz-transition: margin 0.4s, background 0.4s;
4 -o-transition: margin 0.4s, background 0.4s;
5 transition: margin 0.4s, background 0.4s;
6}
7
8@mixin borderRadius {
9 -webkit-border-radius: 60px;
10 -moz-border-radius: 60px;
11 -ms-border-radius: 60px;
12 border-radius: 60px;
13}
14
15.toggle-switch {
16 position: absolute;
17 margin-left: -9999px;
18 visibility: hidden;
19}
20.toggle-switch + label {
21 display: block;
22 position: relative;
23 cursor: pointer;
24 outline: none;
25 -webkit-user-select: none;
26 -moz-user-select: none;
27 -ms-user-select: none;
28 user-select: none;
29}
30
31input.toggle-switch__round-flat + label {
32 padding: 2px;
33 width: 50px;
34 height: 30px;
35 background-color: $lightgrey;
36 @include borderRadius;
37 @include marginTransition;
38}
39input.toggle-switch__round-flat + label:before, input.toggle-switch__round-flat + label:after {
40 display: block;
41 position: absolute;
42 content: "";
43}
44input.toggle-switch__round-flat + label:before {
45 top: 2px;
46 left: 2px;
47 bottom: 2px;
48 right: 2px;
49 background-color: $white;
50 @include borderRadius;
51 @include marginTransition;
52}
53input.toggle-switch__round-flat + label:after {
54 top: 4px;
55 left: 4px;
56 bottom: 4px;
57 width: 20px;
58 background-color: $lightgrey;
59 -webkit-border-radius: 52px;
60 -moz-border-radius: 52px;
61 -ms-border-radius: 52px;
62 border-radius: 52px;
63 @include marginTransition;
64}
65input.toggle-switch__round-flat:checked + label {
66 background-color: $primebtn__bg;
67}
68input.toggle-switch__round-flat:checked + label:before {
69 background-color: $lightbg__accent;
70}
71input.toggle-switch__round-flat:checked + label:after {
72 margin-left: 20px;
73 background-color: $primebtn__bg;
74}