hugo-theme-zzo/assets/sass/components/_switch.scss

65 lines
1.1 KiB
SCSS

.switch {
position: relative;
display: inline-block;
width: 28px;
height: 14px;
margin-bottom: 0.6rem;
margin-left: 1rem;
}
.switch input {
opacity: 0;
width: 0;
height: 0;
}
.slider {
position: absolute;
cursor: pointer;
top: 0;
left: 0;
right: 0;
bottom: 0;
@include transition(all, 0.2s, ease);
@include themify($themes) {
background-color: themed('switch-background-color');
}
}
.slider:before {
position: absolute;
content: "";
height: 11px;
width: 11px;
left: 1.72px;
bottom: 1.72px;
@include transition(all, 0.2s, ease);
@include themify($themes) {
background-color: themed('switch-button-color');
}
}
input:checked + .slider {
@include themify($themes) {
background-color: themed('switch-active-color');
}
}
input:focus + .slider {
@include themify($themes) {
box-shadow: 0 0 1px themed('switch-active-color');
}
}
input:checked + .slider:before {
@include translateX(13px);
}
/* Rounded sliders */
.slider.round {
border-radius: 8.5px;
}
.slider.round:before {
border-radius: 50%;
}