-
Notifications
You must be signed in to change notification settings - Fork 0
/
nabbous-slidebox.css
77 lines (76 loc) · 2.02 KB
/
nabbous-slidebox.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
input[type=checkbox].nabbous-slidebox {
-webkit-appearance: none !important;
-moz-appearance: none !important;
-ms-appearance: none !important;
-o-appearance: none !important;
appearance: none !important;
line-height: 0px;
position: relative;
color: blue;
transition: filter 0.2s ease-in-out;
outline: 0 !important;
cursor: pointer;
padding: 0 0.4em;
filter: saturate(0) brightness(150%);
}
input[type=checkbox].nabbous-slidebox:focus::after {
outline: auto 5px -webkit-focus-ring-color;
}
input[type=checkbox].nabbous-slidebox::before {
direction: ltr;
position: absolute;
content: '\f111\f111\f111\f111\f111\f111\f111';
font-weight: 900;
font-family: 'Font Awesome 5 Free';
display: block;
letter-spacing: -0.8em;
margin-left: 0.4em;
left: 50%;
top: 50%;
transform-origin: center center;
transform: translate(-50%, -50%) scale(0.8);
width: 3.2em;
filter: brightness(150%);
}
input[type=checkbox].nabbous-slidebox::after {
line-height: 1em;
position: relative;
content: '\f111';
font-weight: 900;
padding: 0.4em;
font-family: 'Font Awesome 5 Free';
display: block;
transform-origin: center center;
animation-duration: 0.2s;
animation-timing-function: cubic-bezier(0.68, -0.6, 0.32, 1.6);
animation-fill-mode: forwards;
animation-name: slideboxUnchecked;
}
input[type=checkbox].nabbous-slidebox:checked {
filter: saturate(1);
}
input[type=checkbox].nabbous-slidebox:checked::after {
animation-name: slideboxChecked;
}
input[type=checkbox].nabbous-slidebox:active:checked::after {
transform: translateX(calc(50% - 0.4em)) scale(1.1) !important;
}
input[type=checkbox].nabbous-slidebox:active:not(:checked)::after {
transform: translateX(calc(-50% + 0.4em)) scale(1.1) !important;
}
@keyframes slideboxChecked {
from {
transform: translateX(calc(-50% + 0.4em));
}
to {
transform: translateX(calc(50% - 0.4em));
}
}
@keyframes slideboxUnchecked {
from {
transform: translateX(calc(50% - 0.4em));
}
to {
transform: translateX(calc(-50% + 0.4em));
}
}