Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/shared/style/switches.css
blob: a000293fffa57c6398215d97f54583fd376d1d10 (plain)
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
/* ----------------------------------
 * CHECKBOXES / RADIOS
 * ---------------------------------- */

label:not([for])  {
  display: inline-block;
  vertical-align: middle;
  width: 5rem;
  height: 5rem;
  position: relative;
  background: none;
}

label:not([for]) input {
  margin: 0;
  opacity: 0;
  position: absolute;
  top: 0;
  left: 0;
}

label:not([for]) input + span {
  position: absolute;
  left: 50%;
  top: 50%;
  margin: -1.1rem 0 0 -1.1rem;
  width: 2.2rem;
  height: 2.2rem;
  pointer-events: none;
}

label:not([for]) input[type="checkbox"] + span {
  background: url(switches/images/check/default.png) no-repeat center top;
}

label:not([for]) input[type="radio"] + span {
  background: url(switches/images/radio/default.png) no-repeat center top;
}

label:not([for]) input:checked + span {
  background-position: center bottom;
}

/* 'Dangerous' switches */

label:not([for]).danger input[type="checkbox"] + span {
  background-image: url(switches/images/check/danger.png);
}

label:not([for]).danger input[type="radio"] + span {
  background-image: url(switches/images/radio/danger.png);
}


/* ----------------------------------
 * ON/OFF SWITCHES
 * ---------------------------------- */

label input[type="checkbox"][data-type="switch"] + span {
  position: absolute;
  left: 50%;
  top: 50%;
  margin: -1.1rem 0 0 -2.7rem;
  width: 5.4rem;
  height: 2.2rem;
  pointer-events: none;
  border: solid 1px #c2c2c2;
  border-radius: 5.4rem;
  overflow: hidden;
  background: url(switches/images/switch/handler.png) no-repeat -0.2rem center;
  background-size: auto calc(100% + 2px);
  transition: background 0.18s ease;
}

label input[data-type="switch"] + span:after,
label input[data-type="switch"] + span:before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 5.4rem;
  z-index: -1;
  transition: transform 0.2s ease;
}

label input[data-type="switch"] + span:before {
  right: 100%;
  background: #00c3ea url(switches/images/switch/icon.png) no-repeat 0.5rem center;
  background-size: auto calc(100% - 2px);
}

label input[data-type="switch"] + span:after {
  left: 100%;
  background: #e6e6e6;
  transform: translateX(-5.4rem);
}

/* switch: disabled state */
label input[data-type="switch"]:disabled + span:before,
label input[data-type="switch"]:disabled + span:after {
  opacity: 0.2;
}

label input[data-type="switch"]:disabled + span {
  opacity: 0.3;
}

label input[data-type="switch"]:checked:disabled + span {
  opacity: 1;
  border: solid 1px #A7DBE6;
}

/* 'ON' state */

label input[data-type="switch"]:checked + span {
  border-color: #00acce;
  background-position: 3.2rem center;
}

label input[data-type="switch"]:checked + span:before {
  transform: translateX(5.4rem);
}

label input[data-type="switch"]:checked + span:after {
  transform: translateX(0);
}