css - input range 怎样让滑过的部分变色
本文介绍了css - input range 怎样让滑过的部分变色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
问 题
<input type="range" min="0" max="50000" step="100" value="0">
input[type="range"] {
display: block;
-webkit-appearance: none;
background-color: #bdc3c7;
width: 100%;
height: 2px;
border-radius: 2px;
margin: 0 auto;
outline: 0;
}
input[type="range"]:before{
content: '';
width: 10px;
height: 3px;
background-color: blue;
}
input[type="range"]::-webkit-slider-thumb {
position: relative;
-webkit-appearance: none;
background-color: #e74c3c;
width: 20px;
height: 20px;
border-radius: 50%;
border: 2px solid white;
cursor: pointer;
transition: 0.3s ease-in-out;
-webkit-box-shadow: 0 1px 1px black inset;
}
js:
var elem = document.querySelector('input[type="range"]');
var rangeValue = function(){
var newValue = elem.value;
var target = document.querySelector('.value');
target.innerHTML = newValue;
};
elem.addEventListener("input", rangeValue);
想要实现
小圆滑过之后前面的颜色改变
解决方案
<link href="http://cdn.bootcss.com/ionic/1.2.4/css/ionic.css" rel="stylesheet">
<div class="item range range-positive">
<input type="range">
</div>
似乎只有chrome可用?
这篇关于css - input range 怎样让滑过的部分变色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文