-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcantoggle.css
130 lines (130 loc) · 3.93 KB
/
cantoggle.css
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
123
124
125
126
127
128
129
130
.can-toggle {
position: relative;
}
.can-toggle *, .can-toggle *:before, .can-toggle *:after {
box-sizing: border-box;
}
.can-toggle input[type="checkbox"] {
opacity: 0;
position: absolute;
top: 0;
left: 0;
}
.can-toggle input[type="checkbox"][disabled] ~ label {
pointer-events: none;
}
.can-toggle input[type="checkbox"][disabled] ~ label .can-toggle__switch {
opacity: 0.4;
}
.can-toggle input[type="checkbox"]:checked ~ label .can-toggle__switch:before {
content: attr(data-unchecked);
left: 0;
}
.can-toggle input[type="checkbox"]:checked ~ label .can-toggle__switch:after {
content: attr(data-checked);
}
.can-toggle label {
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
position: relative;
display: flex;
align-items: center;
}
.can-toggle label .can-toggle__label-text {
flex: 1;
padding-left: 32px;
}
.can-toggle label .can-toggle__switch {
position: relative;
margin-left: 15px;
}
.can-toggle label .can-toggle__switch:before {
content: attr(data-checked);
position: absolute;
top: 0;
text-transform: uppercase;
text-align: center;
}
.can-toggle label .can-toggle__switch:after {
content: attr(data-unchecked);
position: absolute;
z-index: 5;
text-transform: uppercase;
text-align: center;
background: white;
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);
}
.can-toggle input[type="checkbox"]:focus ~ label .can-toggle__switch, .can-toggle input[type="checkbox"]:hover ~ label .can-toggle__switch {
background-color: #777;
}
.can-toggle input[type="checkbox"]:focus ~ label .can-toggle__switch:after, .can-toggle input[type="checkbox"]:hover ~ label .can-toggle__switch:after {
color: #000;
}
.can-toggle input[type="checkbox"]:checked ~ label:hover {
color: #000;
}
.can-toggle input[type="checkbox"]:checked ~ label .can-toggle__switch {
background-color: #70c767;
}
.can-toggle input[type="checkbox"]:checked:focus ~ label .can-toggle__switch, .can-toggle input[type="checkbox"]:checked:hover ~ label .can-toggle__switch {
background-color: #5fc054;
}
.can-toggle input[type="checkbox"]:checked:focus ~ label .can-toggle__switch:after, .can-toggle input[type="checkbox"]:checked:hover ~ label .can-toggle__switch:after {
color: #000;
}
.can-toggle label .can-toggle__label-text {
flex: 1;
}
.can-toggle label .can-toggle__switch {
transition: background-color 0.3s cubic-bezier(0, 1, 0.5, 1);
background: #848484;
}
.can-toggle label .can-toggle__switch:before {
color: rgba(255, 255, 255, 0.5);
}
.can-toggle label .can-toggle__switch:after {
transition: -webkit-transform 0.3s cubic-bezier(0, 1, 0.5, 1);
transition: transform 0.3s cubic-bezier(0, 1, 0.5, 1);
transition: transform 0.3s cubic-bezier(0, 1, 0.5, 1), -webkit-transform 0.3s cubic-bezier(0, 1, 0.5, 1);
color: #000;
}
.can-toggle input[type="checkbox"]:focus ~ label .can-toggle__switch:after, .can-toggle input[type="checkbox"]:hover ~ label .can-toggle__switch:after {
box-shadow: 0 3px 3px rgba(0, 0, 0, 0.4);
}
.can-toggle input[type="checkbox"]:checked ~ label .can-toggle__switch:after {
-webkit-transform: translate3d(50px, 0, 0);
transform: translate3d(50px, 0, 0);
}
.can-toggle input[type="checkbox"]:checked:focus ~ label .can-toggle__switch:after, .can-toggle input[type="checkbox"]:checked:hover ~ label .can-toggle__switch:after {
box-shadow: 0 3px 3px rgba(0, 0, 0, 0.4);
}
.can-toggle label {
font-size: 14px;
font-weight: bold;
}
.can-toggle label .can-toggle__switch {
height: 36px;
flex: 0 0 105px;
border-radius: 4px;
}
.can-toggle label .can-toggle__switch:before {
left: 50px;
font-size: 12px;
line-height: 36px;
width: 50px;
padding: 0 12px;
}
.can-toggle label .can-toggle__switch:after {
top: 2px;
left: 2px;
border-radius: 2px;
width: 50px;
line-height: 32px;
font-size: 12px;
}
.can-toggle label .can-toggle__switch:hover:after {
box-shadow: 0 3px 3px rgba(0, 0, 0, 0.4);
}