这是我的范围滑块:JS Bin
HTML:
<div id="slider"></div>
<div id="legend"></div>
JS:
var items =[ 'student','bachelor','masterstudent',' PHD'];
var s = $("#slider");
s.slider({
min:1,
max:items.length
});
var oneBig = 100 / (items.length - 1);
$.each(items, function(key,value){
var w = oneBig;
if(key === 0 || key === items.length-1)
w = oneBig/2;
$("#legend").append("<label style='width: "+w+"%'>"+value+"</laben>");
});
CSS:
label{
display: inline-block;
text-align:center;
}
label:first-child{
text-align:left;
}
label:last-child{
text-align:right;
}
如何将此范围滑块中的标签显示为 val 输入,如JS Bin