【发布时间】:2013-09-23 09:20:37
【问题描述】:
我正在使用 Jquery 旋钮 (http://anthonyterrien.com/knob/),它工作得很好,但我不想在中间显示一个无量纲的数字,我想用它来显示单位 ei % 或 F 等...我该怎么做?
【问题讨论】:
标签: jquery jquery-plugins jquery-knob
我正在使用 Jquery 旋钮 (http://anthonyterrien.com/knob/),它工作得很好,但我不想在中间显示一个无量纲的数字,我想用它来显示单位 ei % 或 F 等...我该怎么做?
【问题讨论】:
标签: jquery jquery-plugins jquery-knob
$("input.Measure").knob({
min: 1
max: 10
stopper: true,
readOnly: false,//if true This will Set the Knob readonly cannot click
draw: function () {
$(this.i).val(this.cv + '%') //Puts a percent after values
},
release: function (value) {
//Do something as you release the mouse
}
});
【讨论】:
正如 Ben 在 Adding Percentages to jquery knob input value 上解释的那样,在最新版本 (>1.2.7) 上,您可以使用格式挂钩:
$(".dial").knob({
'format' : function (value) {
return value + '%';
}
});
【讨论】: