我有一个圆形滑块小部件,我正在尝试为其值添加单位,当值 = 0-999 时,赫兹单位应该显示在值旁边,当值 = 1000-999999 时,它是 KHz ......等等向前。
这是我原来的滑块:
$("#slider").roundSlider({
sliderType: "min-range",
radius: 150,
handleSize: "+12",
mouseScrollAction: true,
min: 0,
max: 100000000,
value: 0, // default value at start
change: function(event) {
$.getJSON('/set_Frequency/' + event.value);
}
});
这是我的非工作尝试:
$("#slider").roundSlider({
sliderType: "min-range",
radius: 150,
handleSize: "+12",
mouseScrollAction: true,
min: 0,
max: 100000000,
value: 0, // default value at start
//change: function(event) { $.getJSON('/valueofslider', {slide1_val: event.value}); }
change: function(event) {
var value = event.value, content;
if (value <= 999) content = "Hz";
else if (value <= 999999) content = "KHz";
else if (value >= 1000000) content = "MHz";
else content = "GHz";
$.getJSON('/set_Frequency/' + event.value + content);
}
});
你能帮忙吗?