我使用 html、css、bootstrap 3、javascript/jquery。当用户增加 slider 拇指时,我想用与 slider 背景颜色不同的颜色标记 html 范围 slider 。
.ios-range-slider {
-webkit-appearance: none;
border-radius: 10px;
background-color: #C1C9C8;
width: 100%;
}
input[type="range"]::-webkit-slider-thumb{
-webkit-appearance: none;
background-color: white;
border-radius: 10px;
width: 15px;
height: 15px;
}
最佳答案
一个非常简单的解决方案是使用 jQuery。
$(document).ready(function(){
$(".ios-range-slider").change(function(){
var val = $(this).val();
$(this).css("background-color","rgb("+(val*10)+","+(val*10)+","+(val*10)+")");
});
});
这里是 JSFiddle .
关于javascript - 如何用灰色标记 html 范围 slider (已选择的所有区域)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32534824/