sonarr-repo-only/UI/Content/bootstrap.toggle-switch.css

230 lines
4.1 KiB
CSS
Raw Normal View History

2013-04-25 18:58:38 +00:00
/* ------------------------------------------
CSS TOGGLE SWITCHES (Ionuț Colceriu)
Licensed under Unlicense
https://github.com/ghinda/css-toggle-switch
------------------------------------------ */
/* Hide by default */
.switch .slide-button,
.toggle p span {
display: none;
}
/* Toggle Switches */
/* We can't test for a specific feature,
* so we only target browsers with support for media queries.
*/
@media only screen {
/* Checkbox
*/
.toggle {
position: relative;
padding: 0;
margin-left: 100px;
}
/* Position the label over all the elements, except the slide-button
* Clicking anywhere on the label will change the switch-state
*/
.toggle label {
position: relative;
z-index: 3;
display: block;
width: 100%;
}
/* Don't hide the input from screen-readers and keyboard access
*/
.toggle input {
position: absolute;
opacity: 0;
z-index: 5;
}
.toggle p {
position: absolute;
left: -100px;
width: 100%;
margin: 0;
padding-right: 100px;
text-align: left;
}
.toggle p span {
position: absolute;
top: 0;
left: 0;
z-index: 5;
display: block;
width: 50%;
margin-left: 100px;
text-align: center;
color: #F5F5F5;
2013-04-25 18:58:38 +00:00
}
.toggle p span:last-child {
left: 50%;
}
.toggle .slide-button {
position: absolute;
right: 0;
top: 0;
z-index: 4;
display: inline;
2013-04-25 18:58:38 +00:00
width: 50%;
height: 100%;
padding: 0;
}
/* Radio Switch
*/
.switch {
position: relative;
padding: 0;
}
.switch input {
position: absolute;
opacity: 0;
}
.switch label {
position: relative;
z-index: 2;
float: left;
width: 50%;
height: 100%;
margin: 0;
text-align: center;
}
.switch .slide-button {
position: absolute;
top: 0;
left: 0;
padding: 0;
z-index: 1;
width: 50%;
height: 100%;
}
.switch input:last-of-type:checked ~ .slide-button {
left: 50%;
}
/* Switch with 3 items */
.switch.switch-three label,
.switch.switch-three .slide-button {
width: 33.3%;
}
.switch.switch-three input:checked:nth-of-type(2) ~ .slide-button {
left: 33.3%;
}
.switch.switch-three input:checked:last-of-type ~ .slide-button {
left: 66.6%;
}
/* Switch with 4 items */
.switch.switch-four label,
.switch.switch-four .slide-button {
width: 25%;
}
.switch.switch-four input:checked:nth-of-type(2) ~ .slide-button {
left: 25%;
}
.switch.switch-four input:checked:nth-of-type(3) ~ .slide-button {
left: 50%;
}
.switch.switch-four input:checked:last-of-type ~ .slide-button {
left: 75%;
}
/* Switch with 5 items */
.switch.switch-five label,
.switch.switch-five .slide-button {
width: 20%;
}
.switch.switch-five input:checked:nth-of-type(2) ~ .slide-button {
left: 20%;
}
.switch.switch-five input:checked:nth-of-type(3) ~ .slide-button {
left: 40%;
}
.switch.switch-five input:checked:nth-of-type(4) ~ .slide-button {
left: 60%;
}
.switch.switch-five input:checked:last-of-type ~ .slide-button {
left: 80%;
}
/* Shared */
.toggle,
.switch {
display: block;
height: 30px;
}
.switch *,
.toggle * {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
-ms-box-sizing: border-box;
-o-box-sizing: border-box;
box-sizing: border-box;
}
.switch .slide-button,
.toggle .slide-button {
display: block;
-webkit-transition: all 0.3s ease-in 0s;
-moz-transition: all 0.3s ease-in 0s;
-ms-transition: all 0.3s ease-in 0s;
-o-transition: all 0.3s ease-in 0s;
transition: all 0.3s ease-in 0s;
2013-04-25 18:58:38 +00:00
}
.toggle label,
.toggle p,
.switch label {
line-height: 30px;
vertical-align: middle;
}
.toggle input:checked ~ .slide-button {
right: 50%;
}
/* Outline the toggles when the inputs are focused */
/*.toggle input:focus ~ .slide-button,*/
/* WHY?! It looks awful and it seems to bug out in FF */
/*.switch input:focus + label {*/
/*outline: 1px dotted #888;*/
/*}*/
2013-04-25 18:58:38 +00:00
/* Bugfix for older Webkit, including mobile Webkit. Adapted from:
* http://css-tricks.com/webkit-sibling-bug/
*/
.switch, .toggle {
-webkit-animation: bugfix infinite 1s;
}
@-webkit-keyframes bugfix { from { position: relative; } to { position: relative; } }
}