i want to do a toggle switch for language, but i don’t have exactly idea how to do it. It’s css with html and i wrote this
HTML
<div class="toggle toggle--neon">
<input type="checkbox" id="toggle--neon" class="toggle--checkbox">
<label class="toggle--btn" for="toggle--neon" data-label-on="on" data-label-off="off"></label>
</div>
CSS
input[type=checkbox] {
height: 0;
width: 0;
visibility: hidden;
}
label {
cursor: pointer;
text-indent: -9999px;
width: 200px;
height: 100px;
background: grey;
display: block;
border-radius: 100px;
position: relative;
}
label:after {
content: '';
position: absolute;
top: 5px;
left: 5px;
width: 90px;
height: 90px;
background: url('/images/lang-en.png') no-repeat top left;
border-radius: 90px;
transition: 0.3s;
}
input:checked + label {
background: url('/images/lang-es.png') no-repeat top left;
}
input:checked + label:after {
left: calc(100% - 5px);
transform: translateX(-100%);
}
label:active:after {
width: 130px;
}