mdb-ui-kit/less/_togglebutton.less

70 lines
2.1 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
2015-03-16 16:47:55 +03:00
input[type=checkbox] {
2014-12-01 15:29:34 +03:00
opacity: 0;
width: 0;
height:0;
}
// Switch bg off and disabled
.toggle,
2015-03-16 16:47:55 +03:00
input[type=checkbox][disabled] + .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-03-16 16:47:55 +03:00
input[type=checkbox][disabled] + .toggle:after,
input[type=checkbox][disabled]:checked + .toggle:after{
2014-12-01 15:29:34 +03:00
background-color: #BDBDBD;
}
// Ripple off and disabled
2015-03-16 16:47:55 +03:00
input[type=checkbox] + .toggle:active:after,
input[type=checkbox][disabled] + .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-03-16 16:47:55 +03:00
input[type=checkbox]:checked + .toggle:after {
2014-12-01 15:29:34 +03:00
left: 15px;
}
}
2015-03-09 22:56:57 +03:00
// Switch bg on
// SASS conversion note: please mirror any content change in _mixins-shared.scss bg-color-variations-content
2015-03-16 16:47:55 +03:00
.generic-variations(~" label input[type=checkbox]:checked + .toggle", @primary, {
2015-03-09 22:56:57 +03:00
background-color: fade(@material-color, 50%);
});
// Handle on
// SASS conversion note: please mirror any content change in _mixins-shared.scss variations-content
2015-03-16 16:47:55 +03:00
.variations(~" label input[type=checkbox]:checked + .toggle:after", background-color, @primary);
// Ripple on
2015-03-16 16:47:55 +03:00
.generic-variations(~" label input[type=checkbox]: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
}