| 1 |
/* |
| 2 |
* CSS TOGGLE SWITCHES |
| 3 |
* Unlicense |
| 4 |
* |
| 5 |
* IonuČ› Colceriu - ghinda.net |
| 6 |
* https://github.com/ghinda/css-toggle-switch |
| 7 |
* |
| 8 |
*/ |
| 9 |
/* Toggle Switches |
| 10 |
*/ |
| 11 |
/* Shared |
| 12 |
*/ |
| 13 |
/* Checkbox |
| 14 |
*/ |
| 15 |
/* Radio Switch |
| 16 |
*/ |
| 17 |
/* Hide by default |
| 18 |
*/ |
| 19 |
.switch-toggle a, .switch-light span span { |
| 20 |
display: none; } |
| 21 |
|
| 22 |
/* We can't test for a specific feature, |
| 23 |
* so we only target browsers with support for media queries. |
| 24 |
*/ |
| 25 |
@media only screen { |
| 26 |
/* Checkbox switch |
| 27 |
*/ |
| 28 |
/* Radio switch |
| 29 |
*/ |
| 30 |
/* Standalone Themes */ |
| 31 |
/* Candy Theme |
| 32 |
* Based on the "Sort Switches / Toggles (PSD)" by Ormal Clarck |
| 33 |
* http://www.premiumpixels.com/freebies/sort-switches-toggles-psd/ |
| 34 |
*/ |
| 35 |
/* Android Theme |
| 36 |
*/ |
| 37 |
/* iOS Theme |
| 38 |
*/ |
| 39 |
.switch-light { |
| 40 |
display: block; |
| 41 |
height: 30px; |
| 42 |
/* Outline the toggles when the inputs are focused |
| 43 |
*/ |
| 44 |
position: relative; |
| 45 |
overflow: visible; |
| 46 |
padding: 0; |
| 47 |
margin-left: 100px; |
| 48 |
/* Position the label over all the elements, except the slide-button (<a>) |
| 49 |
* Clicking anywhere on the label will change the switch-state |
| 50 |
*/ |
| 51 |
/* Don't hide the input from screen-readers and keyboard access |
| 52 |
*/ } |
| 53 |
.switch-light * { |
| 54 |
-webkit-box-sizing: border-box; |
| 55 |
-moz-box-sizing: border-box; |
| 56 |
box-sizing: border-box; } |
| 57 |
.switch-light a { |
| 58 |
display: block; |
| 59 |
-webkit-transition: all 0.3s ease-out; |
| 60 |
-moz-transition: all 0.3s ease-out; |
| 61 |
transition: all 0.3s ease-out; } |
| 62 |
.switch-light label, .switch-light > span { |
| 63 |
line-height: 30px; |
| 64 |
vertical-align: middle; } |
| 65 |
.switch-light input:focus ~ a, .switch-light input:focus + label { |
| 66 |
outline: 1px dotted #888; } |
| 67 |
.switch-light label { |
| 68 |
position: relative; |
| 69 |
z-index: 3; |
| 70 |
display: block; |
| 71 |
width: 100%; } |
| 72 |
.switch-light input { |
| 73 |
position: absolute; |
| 74 |
opacity: 0; |
| 75 |
z-index: 5; } |
| 76 |
.switch-light input:checked ~ a { |
| 77 |
right: 0%; } |
| 78 |
.switch-light > span { |
| 79 |
position: absolute; |
| 80 |
left: -100px; |
| 81 |
width: 100%; |
| 82 |
margin: 0; |
| 83 |
padding-right: 100px; |
| 84 |
text-align: left; } |
| 85 |
.switch-light > span span { |
| 86 |
position: absolute; |
| 87 |
top: 0; |
| 88 |
left: 0; |
| 89 |
z-index: 5; |
| 90 |
display: block; |
| 91 |
width: 50%; |
| 92 |
margin-left: 100px; |
| 93 |
text-align: center; } |
| 94 |
.switch-light > span span:last-child { |
| 95 |
left: 50%; } |
| 96 |
.switch-light a { |
| 97 |
position: absolute; |
| 98 |
right: 50%; |
| 99 |
top: 0; |
| 100 |
z-index: 4; |
| 101 |
display: block; |
| 102 |
width: 50%; |
| 103 |
height: 100%; |
| 104 |
padding: 0; } |
| 105 |
.switch-toggle { |
| 106 |
display: block; |
| 107 |
height: 30px; |
| 108 |
/* Outline the toggles when the inputs are focused |
| 109 |
*/ |
| 110 |
position: relative; |
| 111 |
/* For callout panels in foundation |
| 112 |
*/ |
| 113 |
padding: 0 !important; |
| 114 |
/* Generate styles for the multiple states */ } |
| 115 |
.switch-toggle * { |
| 116 |
-webkit-box-sizing: border-box; |
| 117 |
-moz-box-sizing: border-box; |
| 118 |
box-sizing: border-box; } |
| 119 |
.switch-toggle a { |
| 120 |
display: block; |
| 121 |
-webkit-transition: all 0.3s ease-out; |
| 122 |
-moz-transition: all 0.3s ease-out; |
| 123 |
transition: all 0.3s ease-out; } |
| 124 |
.switch-toggle label, .switch-toggle > span { |
| 125 |
line-height: 30px; |
| 126 |
vertical-align: middle; } |
| 127 |
.switch-toggle input:focus ~ a, .switch-toggle input:focus + label { |
| 128 |
outline: 1px dotted #888; } |
| 129 |
.switch-toggle input { |
| 130 |
position: absolute; |
| 131 |
opacity: 0; } |
| 132 |
.switch-toggle input + label { |
| 133 |
position: relative; |
| 134 |
z-index: 2; |
| 135 |
float: left; |
| 136 |
width: 50%; |
| 137 |
height: 100%; |
| 138 |
margin: 0; |
| 139 |
text-align: center; } |
| 140 |
.switch-toggle a { |
| 141 |
position: absolute; |
| 142 |
top: 0; |
| 143 |
left: 0; |
| 144 |
padding: 0; |
| 145 |
z-index: 1; |
| 146 |
width: 50%; |
| 147 |
height: 100%; } |
| 148 |
.switch-toggle input:last-of-type:checked ~ a { |
| 149 |
left: 50%; } |
| 150 |
.switch-toggle.switch-3 label, .switch-toggle.switch-3 a { |
| 151 |
width: 33.33333%; } |
| 152 |
.switch-toggle.switch-3 input:checked:nth-of-type(2) ~ a { |
| 153 |
left: 33.33333%; } |
| 154 |
.switch-toggle.switch-3 input:checked:last-of-type ~ a { |
| 155 |
left: 66.66667%; } |
| 156 |
.switch-toggle.switch-4 label, .switch-toggle.switch-4 a { |
| 157 |
width: 25%; } |
| 158 |
.switch-toggle.switch-4 input:checked:nth-of-type(2) ~ a { |
| 159 |
left: 25%; } |
| 160 |
.switch-toggle.switch-4 input:checked:nth-of-type(3) ~ a { |
| 161 |
left: 50%; } |
| 162 |
.switch-toggle.switch-4 input:checked:last-of-type ~ a { |
| 163 |
left: 75%; } |
| 164 |
.switch-toggle.switch-5 label, .switch-toggle.switch-5 a { |
| 165 |
width: 20%; } |
| 166 |
.switch-toggle.switch-5 input:checked:nth-of-type(2) ~ a { |
| 167 |
left: 20%; } |
| 168 |
.switch-toggle.switch-5 input:checked:nth-of-type(3) ~ a { |
| 169 |
left: 40%; } |
| 170 |
.switch-toggle.switch-5 input:checked:nth-of-type(4) ~ a { |
| 171 |
left: 60%; } |
| 172 |
.switch-toggle.switch-5 input:checked:last-of-type ~ a { |
| 173 |
left: 80%; } |
| 174 |
.switch-candy { |
| 175 |
background-color: #2d3035; |
| 176 |
border-radius: 3px; |
| 177 |
color: #fff; |
| 178 |
font-weight: bold; |
| 179 |
text-align: center; |
| 180 |
text-shadow: 1px 1px 1px #191b1e; |
| 181 |
box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.3), 0 1px 0px rgba(255, 255, 255, 0.2); } |
| 182 |
.switch-candy label { |
| 183 |
color: #fff; |
| 184 |
-webkit-transition: color 0.2s ease-out; |
| 185 |
-moz-transition: color 0.2s ease-out; |
| 186 |
transition: color 0.2s ease-out; } |
| 187 |
.switch-candy input:checked + label { |
| 188 |
color: #333; |
| 189 |
text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5); } |
| 190 |
.switch-candy a { |
| 191 |
border: 1px solid #333; |
| 192 |
background-color: #70c66b; |
| 193 |
border-radius: 3px; |
| 194 |
background-image: -webkit-linear-gradient(top, rgba(255, 255, 255, 0.2), rgba(0, 0, 0, 0)); |
| 195 |
background-image: linear-gradient(to bottom, rgba(255, 255, 255, 0.2), rgba(0, 0, 0, 0)); |
| 196 |
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.2), inset 0 1px 1px rgba(255, 255, 255, 0.45); } |
| 197 |
.switch-candy > span { |
| 198 |
color: #333; |
| 199 |
text-shadow: none; } |
| 200 |
.switch-candy span { |
| 201 |
color: #fff; } |
| 202 |
.switch-candy.switch-candy-blue a { |
| 203 |
background-color: #38a3d4; } |
| 204 |
.switch-candy.switch-candy-yellow a { |
| 205 |
background-color: #f5e560; } |
| 206 |
.switch-android { |
| 207 |
background-color: #464747; |
| 208 |
border-radius: 1px; |
| 209 |
color: #fff; |
| 210 |
box-shadow: inset rgba(0, 0, 0, 0.1) 0 1px 0; |
| 211 |
/* Selected ON switch-light |
| 212 |
*/ } |
| 213 |
.switch-android label { |
| 214 |
color: #fff; } |
| 215 |
.switch-android > span span { |
| 216 |
opacity: 0; |
| 217 |
-webkit-transition: all 0.1s; |
| 218 |
-moz-transition: all 0.1s; |
| 219 |
transition: all 0.1s; } |
| 220 |
.switch-android > span span:first-of-type { |
| 221 |
opacity: 1; } |
| 222 |
.switch-android a { |
| 223 |
background-color: #666; |
| 224 |
border-radius: 1px; |
| 225 |
box-shadow: inset rgba(255, 255, 255, 0.2) 0 1px 0, inset rgba(0, 0, 0, 0.3) 0 -1px 0; } |
| 226 |
.switch-android.switch-light input:checked ~ a { |
| 227 |
background-color: #0E88B1; } |
| 228 |
.switch-android.switch-light input:checked ~ span span:first-of-type { |
| 229 |
opacity: 0; } |
| 230 |
.switch-android.switch-light input:checked ~ span span:last-of-type { |
| 231 |
opacity: 1; } |
| 232 |
.switch-android.switch-toggle, .switch-android > span span { |
| 233 |
font-size: 85%; |
| 234 |
text-transform: uppercase; } |
| 235 |
.switch-ios.switch-light { |
| 236 |
color: #868686; } |
| 237 |
.switch-ios.switch-light a { |
| 238 |
left: 0; |
| 239 |
width: 30px; |
| 240 |
background-color: #fff; |
| 241 |
border: 1px solid #d3d3d3; |
| 242 |
border-radius: 100%; |
| 243 |
-webkit-transition: all 0.3s ease-out; |
| 244 |
-moz-transition: all 0.3s ease-out; |
| 245 |
transition: all 0.3s ease-out; |
| 246 |
box-shadow: inset 0 -3px 3px rgba(0, 0, 0, 0.025), 0 1px 4px rgba(0, 0, 0, 0.15), 0 4px 4px rgba(0, 0, 0, 0.1); } |
| 247 |
.switch-ios.switch-light > span span { |
| 248 |
width: 100%; |
| 249 |
left: 0; |
| 250 |
opacity: 0; } |
| 251 |
.switch-ios.switch-light > span span:first-of-type { |
| 252 |
opacity: 1; |
| 253 |
padding-left: 30px; } |
| 254 |
.switch-ios.switch-light > span span:last-of-type { |
| 255 |
padding-right: 30px; } |
| 256 |
.switch-ios.switch-light > span:before { |
| 257 |
content: ''; |
| 258 |
display: block; |
| 259 |
width: 100%; |
| 260 |
height: 100%; |
| 261 |
position: absolute; |
| 262 |
left: 100px; |
| 263 |
top: 0; |
| 264 |
background-color: #fafafa; |
| 265 |
border: 1px solid #d3d3d3; |
| 266 |
border-radius: 30px; |
| 267 |
-webkit-transition: all 0.5s ease-out; |
| 268 |
-moz-transition: all 0.5s ease-out; |
| 269 |
transition: all 0.5s ease-out; |
| 270 |
box-shadow: inset rgba(0, 0, 0, 0.1) 0 1px 0; } |
| 271 |
.switch-ios.switch-light input:checked ~ a { |
| 272 |
left: 100%; |
| 273 |
margin-left: -30px; } |
| 274 |
.switch-ios.switch-light input:checked ~ span:before { |
| 275 |
border-color: #53d76a; |
| 276 |
box-shadow: inset 0 0 0 30px #53d76a; } |
| 277 |
.switch-ios.switch-light input:checked ~ span span:first-of-type { |
| 278 |
opacity: 0; } |
| 279 |
.switch-ios.switch-light input:checked ~ span span:last-of-type { |
| 280 |
opacity: 1; |
| 281 |
color: #fff; } |
| 282 |
.switch-ios.switch-toggle { |
| 283 |
background-color: #fafafa; |
| 284 |
border: 1px solid #d3d3d3; |
| 285 |
border-radius: 30px; |
| 286 |
box-shadow: inset rgba(0, 0, 0, 0.1) 0 1px 0; } |
| 287 |
.switch-ios.switch-toggle a { |
| 288 |
background-color: #53d76a; |
| 289 |
border-radius: 25px; |
| 290 |
-webkit-transition: all 0.3s ease-out; |
| 291 |
-moz-transition: all 0.3s ease-out; |
| 292 |
transition: all 0.3s ease-out; } |
| 293 |
.switch-ios.switch-toggle label { |
| 294 |
color: #868686; } |
| 295 |
.switch-ios input:checked + label { |
| 296 |
color: #3a3a3a; } } |
| 297 |
|
| 298 |
/* Bugfix for older Webkit, including mobile Webkit. Adapted from |
| 299 |
* http://css-tricks.com/webkit-sibling-bug/ |
| 300 |
*/ |
| 301 |
@media only screen and (-webkit-max-device-pixel-ratio: 2) and (max-device-width: 1280px) { |
| 302 |
.switch-light, .switch-toggle { |
| 303 |
-webkit-animation: webkitSiblingBugfix infinite 1s; } } |
| 304 |
|
| 305 |
@-webkit-keyframes webkitSiblingBugfix { |
| 306 |
from { |
| 307 |
-webkit-transform: translate3d(0, 0, 0); } |
| 308 |
|
| 309 |
to { |
| 310 |
-webkit-transform: translate3d(0, 0, 0); } } |