如何使用Jquery旋钮显示单位

时间:2013-09-23 09:20:38

标签: jquery jquery-plugins jquery-knob

我正在使用Jquery旋钮(http://anthonyterrien.com/knob/)并且它工作得很好但不是在中间显示无维数的数字我想用ei%或F等显示单位...我怎么能这样做?

2 个答案:

答案 0 :(得分:5)

$("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
    }
});

答案 1 :(得分:2)

正如Ben在Adding Percentages to jquery knob input value上解释的那样,在最新版本(> 1.2.7)上,你可以使用格式钩子:

$(".dial").knob({
  'format' : function (value) {
     return value + '%';
  }
});
相关问题