仿网易云音乐 进度条滑块
js:
$('.progress').Progress({
val: 0, //滑块默认值0-100
tip: false, //是否显示数值提示
title: true, //是否鼠标滑入滑块时显示数值,默认为false
toFixed: 2,
size: 4,
getVal: function(res) {
//获取滑块val值
console.log(res)
},
setVal: function(setValue) {
// setValue(cont) 动态根据动态数组更新长度回调方法,
var timeID
var cont = 0
timeID = setInterval(function() {
cont += 0.1
setValue(cont)
if (cont >= 100) {
clearInterval(timeID)
}
}, 15)
}
})css:修改以下样式
.ProgressBar{
background: #f0f0f0;
}
.ProgressLine{
background: #db3e3e;
}
.ProgressLine::before{
background: #db3e3e;
border: 5px solid #fff;
box-shadow: 0px 0px 1px 1px rgba(0, 0, 0, 0.2);
}
回复