2015-12-05 23:00:40 +03:00
|
|
|
.switch {
|
2015-11-22 00:36:03 +03:00
|
|
|
vertical-align: middle;
|
2015-12-05 23:00:40 +03:00
|
|
|
&, label, input, .switch-decorator {
|
2015-11-22 00:36:03 +03:00
|
|
|
user-select: none;
|
2015-11-18 23:53:05 +03:00
|
|
|
}
|
2015-11-22 00:36:03 +03:00
|
|
|
label {
|
2015-12-05 23:00:40 +03:00
|
|
|
color: $mdb-switch-label-color;
|
2015-12-07 22:34:46 +03:00
|
|
|
cursor: pointer;
|
2015-11-18 23:53:05 +03:00
|
|
|
|
2015-11-22 00:36:03 +03:00
|
|
|
// Hide original checkbox
|
|
|
|
input[type=checkbox] {
|
|
|
|
width: 0;
|
|
|
|
height: 0;
|
2015-12-07 22:34:46 +03:00
|
|
|
opacity: 0;
|
2015-11-02 23:39:13 +03:00
|
|
|
}
|
2015-11-22 00:36:03 +03:00
|
|
|
// Switch bg off and disabled
|
2015-12-05 23:00:40 +03:00
|
|
|
.switch-decorator,
|
|
|
|
input[type=checkbox][disabled] + .switch-decorator {
|
2015-11-22 00:36:03 +03:00
|
|
|
display: inline-block;
|
|
|
|
width: 30px;
|
|
|
|
height: 15px;
|
2015-12-07 22:34:46 +03:00
|
|
|
margin-right: 15px;
|
|
|
|
vertical-align: middle;
|
|
|
|
content: "";
|
2015-11-22 00:36:03 +03:00
|
|
|
background-color: rgba(80, 80, 80, 0.7);
|
|
|
|
border-radius: 15px;
|
|
|
|
transition: background 0.3s ease;
|
|
|
|
}
|
|
|
|
// Handle off
|
2015-12-07 22:34:46 +03:00
|
|
|
.switch-decorator::after {
|
|
|
|
position: relative;
|
|
|
|
top: -2px;
|
|
|
|
left: -5px;
|
2015-11-22 00:36:03 +03:00
|
|
|
display: inline-block;
|
|
|
|
width: 20px;
|
|
|
|
height: 20px;
|
2015-12-07 22:34:46 +03:00
|
|
|
content: "";
|
|
|
|
background-color: #f1f1f1;
|
2015-11-22 00:36:03 +03:00
|
|
|
border-radius: 20px;
|
2015-12-07 22:34:46 +03:00
|
|
|
box-shadow: 0 1px 3px 1px rgba($black, 0.4);
|
2015-11-22 00:36:03 +03:00
|
|
|
transition: left 0.3s ease, background 0.3s ease, box-shadow 0.1s ease;
|
|
|
|
}
|
2015-11-25 01:34:17 +03:00
|
|
|
input[type=checkbox] {
|
|
|
|
// Handle disabled
|
|
|
|
&[disabled] {
|
2015-12-07 22:34:46 +03:00
|
|
|
+ .switch-decorator::after,
|
|
|
|
&:checked + .switch-decorator::after {
|
|
|
|
background-color: #bdbdbd;
|
2015-11-25 01:34:17 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-12-07 22:34:46 +03:00
|
|
|
+ .switch-decorator:active::after,
|
|
|
|
&[disabled] + .switch-decorator:active::after {
|
|
|
|
box-shadow: 0 1px 3px 1px rgba($black, 0.4), 0 0 0 15px rgba($black, 0.1);
|
2015-11-25 01:34:17 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
// Ripple off and disabled
|
2015-12-07 22:34:46 +03:00
|
|
|
&:checked + .switch-decorator::after {
|
2015-11-25 01:34:17 +03:00
|
|
|
left: 15px;
|
|
|
|
}
|
2015-11-22 00:36:03 +03:00
|
|
|
}
|
2015-11-25 01:34:17 +03:00
|
|
|
|
2015-12-07 22:34:46 +03:00
|
|
|
label input[type=checkbox]:checked {
|
|
|
|
+ .switch-decorator {
|
|
|
|
background-color: rgba($brand-primary, (50 / 100)); // Switch bg on
|
2015-11-25 01:34:17 +03:00
|
|
|
}
|
|
|
|
|
2015-12-07 22:34:46 +03:00
|
|
|
+ .switch-decorator::after {
|
2015-11-25 01:34:17 +03:00
|
|
|
background-color: $brand-primary; // Handle on
|
|
|
|
}
|
|
|
|
|
2015-12-07 22:34:46 +03:00
|
|
|
+ .switch-decorator:active::after {
|
|
|
|
box-shadow: 0 1px 3px 1px rgba($black, 0.4), 0 0 0 15px rgba($brand-primary, (10 / 100)); // Ripple on
|
2015-11-25 01:34:17 +03:00
|
|
|
}
|
2015-11-02 23:39:13 +03:00
|
|
|
}
|
2015-11-18 23:53:05 +03:00
|
|
|
}
|
2015-11-02 23:39:13 +03:00
|
|
|
}
|