当我更改一个滑块中的值时,它会同时更新,我该如何解决?顺便说一句,我想从具有当前数组索引的元素中获取值并使用它,这可能吗,还是存在更好的解决方案?
const scArr = Array.from($('.slider'));
scArr.forEach(el => $(el).roundSlider({
radius: 80,
circleShape: "half-left",
sliderType: "min-range",
showTooltip: false,
value: 150,
width: 10,
min: 0,
max: 200,
update: function (args) {
$('.value').html(`${args.value} %`);
}
}));
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/roundSlider/1.6.1/roundslider.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/roundSlider/1.6.1/roundslider.css" integrity="sha512-XO53CaiPx+m4HUiZ02P4OEGLyyT46mJQzWhwqYsdqRR7IOjPuujK0UPAK9ckSfcJE4ED7dT9pF9r78yXoOKeYw==" crossorigin="anonymous" />
<div class="container">
<div class="slider"></div>
<div class="value">0 %</div>
</div>
<div class="container">
<div class="slider"></div>
<div class="value">0 %</div>
</div>