Цвет input range
как сделать из такого
такой
плюс чтобы цвет и размеры не менялись
.slider {
-webkit-appearance: none;
width: 100%;
height: 3px;
background: #1B2FB2;
outline: none;
opacity: 0.8;
-webkit-transition: .2s;
transition: opacity .2s;
margin: 12px 0px 5px 0px;
width: 190px;
}
.slider:hover {
opacity: 1;
}
.slider::-webkit-slider-thumb {
appearance: none;
width: 11px;
height: 11px;
border-radius: 100%;
background: #1B2FB2;
cursor: pointer;
}
<input type = "range" min = "0" max = "100" value = "50" class = "slider">
Ответы (1 шт):
Автор решения: Алексей
→ Ссылка
const slider = document.querySelector('.slider');
const progress = document.querySelector('.progress');
slider.oninput = function(){
progress.style.width = `${this.value}%`;
};
.wrapper{
width: 190px;
position: relative;
z-index: 5;
}
.slider {
-webkit-appearance: none;
width: 100%;
height: 3px;
/* background: #1B2FB2; */
background-color: #ccc;
outline: none;
-webkit-transition: .2s;
transition: opacity .2s;
margin: 12px 0px 5px 0px;
cursor: pointer;
}
.slider:hover {
opacity: 1;
}
.slider::-webkit-slider-thumb {
appearance: none;
width: 11px;
height: 11px;
border-radius: 100%;
background: #1B2FB2;
}
.progress{
position: absolute;
content:'';
width: 50%;
height: 3px;
background-color: #1B2FB2;
top: calc(50% + 1.5px);
z-index: 1;
}
<div class="wrapper">
<input type = "range" min = "0" max = "100" value = "50" class = "slider">
<div class="progress"></div>
</div>