2014-12-01 15:29:34 +03:00
|
|
|
.togglebutton {
|
|
|
|
vertical-align: middle;
|
|
|
|
&, * {
|
|
|
|
user-select: none;
|
|
|
|
}
|
|
|
|
label {
|
|
|
|
font-weight: 400;
|
|
|
|
cursor: pointer;
|
|
|
|
// Hide original checkbox
|
2015-02-11 03:44:22 +03:00
|
|
|
input[type=checkbox]:first-of-type {
|
2014-12-01 15:29:34 +03:00
|
|
|
opacity: 0;
|
|
|
|
width: 0;
|
|
|
|
height:0;
|
|
|
|
}
|
|
|
|
// Switch bg on
|
2015-02-11 03:44:22 +03:00
|
|
|
input[type=checkbox]:first-of-type:checked + .toggle {
|
2014-12-01 15:29:34 +03:00
|
|
|
background-color: rgba(0, 149, 135, 0.5);
|
|
|
|
// Handle on
|
|
|
|
&:after {
|
|
|
|
background-color: #009587;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Switch bg off and disabled
|
|
|
|
.toggle,
|
2015-02-11 03:44:22 +03:00
|
|
|
input[type=checkbox][disabled]:first-of-type + .toggle {
|
2014-12-01 15:29:34 +03:00
|
|
|
content: "";
|
|
|
|
display: inline-block;
|
|
|
|
width: 30px;
|
|
|
|
height: 15px;
|
|
|
|
background-color: rgba(80, 80, 80, 0.7);
|
|
|
|
border-radius: 15px;
|
|
|
|
margin-right: 10px;
|
|
|
|
transition: background 0.3s ease;
|
|
|
|
vertical-align: middle;
|
|
|
|
}
|
|
|
|
// Handle off
|
|
|
|
.toggle:after {
|
|
|
|
content: "";
|
|
|
|
display: inline-block;
|
|
|
|
width: 20px;
|
|
|
|
height: 20px;
|
|
|
|
background-color: #F1F1F1;
|
|
|
|
border-radius: 20px;
|
|
|
|
position: relative;
|
|
|
|
box-shadow: 0 1px 3px 1px rgba(0,0,0,0.4);
|
|
|
|
left: -5px;
|
|
|
|
top: -2px;
|
|
|
|
transition: left 0.3s ease, background 0.3s ease, box-shadow 0.1s ease;
|
|
|
|
}
|
|
|
|
// Handle disabled
|
2015-02-11 03:44:22 +03:00
|
|
|
input[type=checkbox][disabled]:first-of-type + .toggle:after,
|
|
|
|
input[type=checkbox][disabled]:checked:first-of-type + .toggle:after{
|
2014-12-01 15:29:34 +03:00
|
|
|
background-color: #BDBDBD;
|
|
|
|
}
|
|
|
|
// Ripple on
|
2015-02-11 03:44:22 +03:00
|
|
|
input[type=checkbox]:first-of-type:checked ~ .toggle:active:after {
|
2014-12-01 15:29:34 +03:00
|
|
|
box-shadow: 0 1px 3px 1px rgba(0,0,0,0.4), 0 0 0 15px rgba(0, 149, 135, 0.1);
|
|
|
|
}
|
|
|
|
// Ripple off and disabled
|
2015-02-11 03:44:22 +03:00
|
|
|
input[type=checkbox]:first-of-type ~ .toggle:active:after,
|
|
|
|
input[type=checkbox][disabled]:first-of-type ~ .toggle:active:after {
|
2014-12-01 15:29:34 +03:00
|
|
|
box-shadow: 0 1px 3px 1px rgba(0,0,0,0.4), 0 0 0 15px rgba(0, 0, 0, 0.1);
|
|
|
|
}
|
2015-02-11 03:44:22 +03:00
|
|
|
input[type=checkbox]:first-of-type:checked + .toggle:after {
|
2014-12-01 15:29:34 +03:00
|
|
|
left: 15px;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|