mdb-ui-kit/less/_togglebutton.less

68 lines
2.0 KiB
Plaintext
Raw Normal View History

2014-12-01 15:29:34 +03:00
.togglebutton {
vertical-align: middle;
2015-03-09 22:56:57 +03:00
&, label, input, .toggle {
2014-12-01 15:29:34 +03:00
user-select: none;
}
label {
2015-03-09 22:56:57 +03:00
font-weight: 400;
cursor: pointer;
2014-12-01 15:29:34 +03:00
// Hide original checkbox
input[type=checkbox]:first-of-type {
2014-12-01 15:29:34 +03:00
opacity: 0;
width: 0;
height:0;
}
// Switch bg off and disabled
.toggle,
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
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 off and disabled
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);
}
input[type=checkbox]:first-of-type:checked + .toggle:after {
2014-12-01 15:29:34 +03:00
left: 15px;
}
}
2015-03-09 22:56:57 +03:00
// Switch bg on
.generic-variations(~" label input[type=checkbox]:first-of-type:checked + .toggle", @primary, {
background-color: fade(@material-color, 50%);
});
// Handle on
.variations(~" label input[type=checkbox]:first-of-type:checked + .toggle:after", background-color, @primary);
// Ripple on
.generic-variations(~" label input[type=checkbox]:first-of-type:checked ~ .toggle:active:after", @primary, {
2015-03-11 19:14:24 +03:00
box-shadow: 0 1px 3px 1px rgba(0,0,0,0.4), 0 0 0 15px fade(@material-color, 10%);
});
2014-12-01 15:29:34 +03:00
}