我有一个简单的 javascipt:
<a href="javascript:;" onclick="max_range(300)">Max 300</a>
<a href="javascript:;" onclick="max_range(1000)">Max 1000</a>
<div id="price"></div>
和javascript函数:
function max_range(max) {
var price = document.getElementById('price');
noUiSlider.create(price, {
connect: true,
behaviour: 'tap',
start: [ 0, max ],
step: 100,
range: {
'min': 0,
'max': max,
}
});
}
// load default
max_range(500);
当我捕捉到事件时。显示此错误"Error: Slider was already initialized."
如何解决?