我试图用滑块控制多个元素的宽度。最好的方法是什么?
<ul>
<li id="text-1">1<div id="slider-vertical" style="height: 200px;"></div></li>
<li id="text-2">2<span id="slider-vertical" style="height: 200px;"></span></li>
<li id="text-3">3<span id="slider-vertical" style="height: 200px;"></span></li>
<li id="text-4">4<span id="slider-vertical" style="height: 200px;"></span></li>
<li id="text-5">5<span id="slider-vertical" style="height: 200px;"></span></li>
<li id="text-6">6<span id="slider-vertical" style="height: 200px;"></span></li>
</ul>
$(document).ready(function() {
$( "#slider-vertical" ).slider({
orientation: "vertical",
range: "min",
min: 0,
max: 100,
value: 0,
slide: function( event, ui ) {
$( "#amount" ).val( ui.value );
$('#text').css('width', ui.value + '%');
//$("#text").text(ui.value + '%');
}
});
});