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

70 lines
1.1 KiB
SCSS

.switch {
position: relative;
width: 28px;
height: 14px;
margin-top: 0.7rem;
margin-left: 1rem;
&[data-ani="true"] {
@include animation('slide-in-down-little .2s .3s 1 ease-in backwards');
}
}
.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%;
}