galaxy/Toggle-switches/Nawsome_green-turkey-32.html

130 lines
2.3 KiB
HTML

<div id="app">
<label class="checker">
<input type="checkbox" class="checkbox">
<div class="check-bg"></div>
<div class="checkmark">
<svg viewBox="0 0 100 100">
<path stroke-linejoin="round" stroke-linecap="round" stroke-width="15" stroke="#FFF" fill="none" d="M20,55 L40,75 L77,27"></path>
</svg>
</div>
</label>
</div>
<style>
/* From Uiverse.io by Nawsome - Tags: switch */
.checker {
display: block;
font-size: 25px;
height: 1em;
width: 2.5em;
box-sizing: content-box;
padding: 0.15em;
border-radius: 0.25em;
cursor: pointer;
}
.checkmark {
width: 1em;
height: 1em;
transform: translateX(-0.4em);
z-index: 5;
}
.checkmark svg {
display: block;
background: #e5e5e5;
transform: translateX(0.4em);
border-radius: 0.15em;
transition: background-color var(--duration) ease, transform calc(var(--duration) * 1.5) ease;
}
.checkmark svg path {
stroke-dasharray: 90 90;
stroke-dashoffset: 90;
transition: stroke-dashoffset calc(var(--duration) / 3) linear calc(var(--duration) / 3);
}
.checkbox {
position: absolute;
top: 0;
left: 0;
opacity: 0.4;
visibility: hidden;
}
.checkbox:checked ~ .checkmark {
transform: translate(1.9em);
}
.checkbox:checked ~ .checkmark svg {
background: #77c44c;
transform: translate(-0.4em);
}
.checkbox:checked ~ .checkmark svg path {
stroke-dashoffset: 0;
}
.check-bg {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
border-radius: inherit;
background: white;
z-index: 2;
}
.check-bg:before, .check-bg:after {
content: "";
position: absolute;
top: 0;
left: 0;
height: 100%;
width: 100%;
border-radius: inherit;
}
.check-bg:after {
background: white;
}
.check-bg:before {
transform: translateY(30%);
transform-origin: bottom center;
background: black;
filter: blur(0.25em);
opacity: 0.2;
z-index: -1;
}
.checker.checker:active {
transform: scale(0.85);
transition-duration: calc(var(--duration) / 2);
}
.checker.checker:active .check-bg::before {
transform: translateY(0) scale(0.8);
opacity: 0.2;
}
*,
*::before,
*::after {
box-sizing: border-box;
position: relative;
}
html {
height: 100%;
}
body {
background-color: #f2f2f2;
height: 100%;
width: 100%;
display: flex;
justify-content: center;
align-items: center;
}
</style>