-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathvc-toggle-switch.css
More file actions
170 lines (133 loc) · 3.31 KB
/
vc-toggle-switch.css
File metadata and controls
170 lines (133 loc) · 3.31 KB
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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
:root {
/*Background color when it's turned off*/
--vc-off-color: #d1d3d4;
/*Background color when it's turned on*/
--vc-on-color: #38cf5b;
/*Animation speed and type*/
--vc-animation-speed: 0.15s ease-out;
/*Font used by the text*/
--vc-font-family: Arial;
/*The size used*/
--vc-font-size: 11px;
/*The font weight*/
--vc-font-weight: 300;
/*Font color when the switch is on*/
--vc-on-font-color: white;
/*Font color when the switch is off*/
--vc-off-font-color: white;
/*How far the OFF text is from the right side*/
--vc-label-position-off: 12px;
/*How far the ON text is from the left side*/
--vc-label-position-on: 11px;
/*Small switch width*/
--vc-width: 50px;
/*Small switch height*/
--vc-height: 25px;
/*Border radius for the handle*/
--vc-handle-border-radius: 20px;
/*Border radius for the box*/
--vc-box-border-radius: 18px;
/*Shadow for the handle*/
--vc-handle-shadow: 1px 1px 5px rgba(0, 0, 0, 0.2);
/*Handle color*/
--vc-handle-color: white;
/*Handle width*/
--vc-handle-width: 15px;
/*Handle height*/
--vc-handle-height: 15px;
/*The handle's width while the toggle is clicked*/
--vc-onclick-width: 30px;
/*Handle's distance from the top*/
--vc-handle-top: 5px;
}
.vc-toggle-container * {
font-family: var(--vc-font-family);
-webkit-transition: var(--vc-animation-speed);
-moz-transition: var(--vc-animation-speed);
-o-transition: var(--vc-animation-speed);
transition: var(--vc-animation-speed);
}
.vc-switch {
width: var(--vc-width);
height: var(--vc-height);
}
.vc-toggle-container label {
position: relative;
display: inline-block;
vertical-align: top;
border-radius: var(--vc-box-border-radius);
cursor: pointer;
}
.vc-switch-input {
position: absolute;
transform: translate3d(5px, 5px, 0);
}
.vc-switch-label {
position: relative;
display: block;
height: inherit;
font-size: var(--vc-font-size);
font-weight: var(--vc-font-weight);
background: var(--vc-off-color);
border-radius: inherit;
}
.vc-switch-label:before,
.vc-switch-label:after {
position: absolute;
top: 50%;
margin-top: -0.5em;
line-height: 1.1;
}
.vc-switch-label:before {
content: attr(data-off);
color: var(--vc-on-font-color);
}
.vc-switch-label:after {
content: attr(data-on);
color: var(--vc-off-font-color);
opacity: 0;
}
.vc-switch-label:before {
right: var(--vc-label-position-off);;
}
.vc-switch-label:after {
left: var(--vc-label-position-on);;
}
.vc-switch-input:checked ~ .vc-switch-label {
background: var(--vc-on-color);
}
.vc-switch-input:checked ~ .vc-switch-label:before {
opacity: 0;
}
.vc-switch-input:checked ~ .vc-switch-label:after {
opacity: 1;
}
.vc-handle {
position: absolute !important;
top: var(--vc-handle-top);
left: 5px;
background: var(--vc-handle-color);
border-radius: var(--vc-handle-border-radius);
box-shadow: var(--vc-handle-shadow);
}
.vc-handle {
width: var(--vc-handle-width);
height: var(--vc-handle-height);
}
.vc-handle:before {
content: "";
top: 50%;
left: 50%;
position: absolute !important;
margin: -6px 0 0 -6px;
width: 12px;
height: 12px;
border-radius: 6px;
}
.vc-switch-label:active ~ .vc-handle, .vc-handle:active {
width: var(--vc-onclick-width);
}
.vc-switch-input:checked ~ .vc-handle {
left: unset;
right: 5px;
}