As you can see I am using the type="range" input slider for this purpose. But I need slider where I will have texts instead of numbers.
var slider = document.getElementById("myRange");
var output = document.getElementById("demo");
output.innerHTML = slider.value;
slider.oninput = function() {
output.innerHTML = this.value;
}
.slidecontainer {
width: 100%;
}
.slider {
-webkit-appearance: none;
width: 100%;
height: 15px;
border-radius: 5px;
background: #d3d3d3;
outline: none;
opacity: 0.7;
-webkit-transition: .2s;
transition: opacity .2s;
}
.slider:hover {
opacity: 1;
}
.slider::-webkit-slider-thumb {
-webkit-appearance: none;
appearance: none;
width: 25px;
height: 25px;
border-radius: 50%;
background: #04AA6D;
cursor: pointer;
}
.slider::-moz-range-thumb {
width: 25px;
height: 25px;
border-radius: 50%;
background: #04AA6D;
cursor: pointer;
}
<div class="slidecontainer">
<input type="range" min="1" max="3" value="2" class="slider" id="myRange">
<p>Value: <span id="demo"></span></p>
</div>
So I need three options "None", "Open" and "Close" and when I slide, automatically if will be moved to the text.
Something like this
Until now I just got the value that is slided on with
slider.oninput = function() {
output.innerHTML = this.value;
}
but I need to insert some text dynamically when 1 is chosen then I need to have Open option for example etc...
Note: It needs to be responsive