-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathswitches.css
executable file
·120 lines (100 loc) · 2.77 KB
/
switches.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
/* ----------------------------------
* CHECKBOXES / RADIOS
* ---------------------------------- */
label.pack-checkbox,
label.pack-radio,
label.pack-switch {
display: inline-block;
vertical-align: middle;
width: 5rem;
height: 5rem;
position: relative;
background: none;
}
label.pack-checkbox input,
label.pack-radio input,
label.pack-switch input {
margin: 0;
opacity: 0;
position: absolute;
top: 0;
/* the conflict between left/right/width is resolved differently in LTR and
* RTL. The goal here is to keep "input" invisible */
left: 0;
right: 0;
width: 0;
}
label.pack-checkbox input ~ span:after,
label.pack-radio input ~ span:after {
content: '';
position: absolute;
left: 50%;
top: 50%;
margin: 0;
margin-top: -1.1rem;
-moz-margin-start: -1.1rem;
width: 2.2rem;
height: 2.2rem;
pointer-events: none;
}
label.pack-checkbox input ~ span:after {
background: url(switches/images/check/default.png) no-repeat center top / 2.2rem auto;
}
label.pack-radio input ~ span:after {
background: url(switches/images/radio/default.png) no-repeat center top / 2.2rem auto;
}
label.pack-checkbox input:checked ~ span:after,
label.pack-radio input:checked ~ span:after,
label.pack-switch input:checked ~ span:after {
background-position: center bottom;
}
/* 'Dangerous' switches */
label.pack-checkbox.danger input ~ span:after {
background-image: url(switches/images/check/danger.png);
}
label.pack-radio.danger input ~ span:after {
background-image: url(switches/images/radio/danger.png);
}
/* ----------------------------------
* ON/OFF SWITCHES
* ---------------------------------- */
label.pack-switch input ~ span:after {
content: '';
position: absolute;
right: 0;
top: 50%;
width: 6rem;
margin: -1.4rem 0 0;
height: 2.7rem;
pointer-events: none;
border-radius: 1.35rem;
overflow: hidden;
background: #e6e6e6 url(switches/images/switch/background_off.png) no-repeat -3.2rem 0 / 9.2rem 2.7rem;
transition: background 0.2s ease;
}
/* switch: 'ON' state */
label.pack-switch input:checked ~ span:after {
background: #e6e6e6 url(switches/images/switch/background.png) no-repeat 0 0 / 9.2rem 2.7rem;
}
/* switch: disabled state */
label.pack-switch input:disabled ~ span:after {
opacity: 0.4;
}
label.pack-switch input.uninit ~ span:after {
transition: none;
}
/******************************************************************************
* Right-To-Left tweaks
*/
html[dir="rtl"] label.pack-switch input ~ span:after {
left: 0;
right: unset;
}
html[dir="rtl"] label.pack-switch input ~ span:after {
background-position: 0;
}
/* switch: 'ON' state */
html[dir="rtl"] label.pack-switch input:checked ~ span:after {
background-image: url(switches/images/switch/background_rtl.png);
background-position: -3.2rem 0;
}