I have designed a range slider with two buttons, but they are overlapping each other. I want to ensure that they do not cross over one another - where the value of the first button should be equal to the minimum value of the second button, and the maximum value of the first button should be equal to the value of the second button. Additionally, I only want the selected range to be displayed in brown color, while the rest remains white.
Below is the code snippet:
.range_container {
display: flex;
flex-direction: column;
margin-top: 30px;
}
.sliders-control {
position: relative;
}
.form_control {
position: relative;
display: flex;
justify-content: space-between;
font-size: 24px;
color: #635a5a;
}
input[type=range]::-webkit-slider-thumb {
-webkit-appearance: none;
pointer-events: all;
width: 15px;
height: 15px;
background-color: #fff;
border-radius: 50%;
box-shadow: 1px 1px 1px 1px gray;
cursor: pointer;
}
input[type=range]::-moz-range-thumb {
-moz-appearance: none;
pointer-events: all;
width: 15px;
height: 15px;
background-color: #fff;
border-radius: 50%;
box-shadow: 1px 1px 1px 1px gray;
cursor: pointer;
}
input[type="range"] {
-webkit-appearance: none;
appearance: none;
height: 10px;
width: 100%;
position: absolute;
background-color: brown;
pointer-events: none;
border-radius: 10px;
border: 1px solid black;
}
.values{
background-color: #3264fe;
width: 32%;
position: relative;
margin: auto;
padding: 10px 0;
border-radius: 5px;
text-align: center;
font-weight: 500;
font-size: 25px;
color: #ffffff;
}
.values:before{
content: "";
position: absolute;
height: 0;
width: 0;
border-top: 15px solid #3264fe;
border-left: 15px solid transparent;
border-right: 15px solid transparent;
margin: auto;
bottom: -14px;
left: 0;
right: 0;
}
#fromSlider {
height: 0;
z-index: 1;
top: 5px;
background: none;
border: none;
}
#min-value {
float: left;
}
#max-value {
float: right;
}
<span id="min-value">₹{{value1}}</span> <span id="max-value">₹{{value2}}</span>
<div class="range_container">
<div class="sliders-control">
<input id="fromSlider" type="range" step="500" [(ngModel)] = "value1" value="{{value1}}" min="7000" max="100000" />
<input id="toSlider" type="range" step="500" [(ngModel)] = "value2" value="{{value2}}" min="7000" max="100000" />
</div>
</div>
Current output:
https://i.sstatic.net/aVLhI.png
Desired output:
https://i.sstatic.net/30Vf6.png
The objective is to prevent the slider buttons from crossing each other.