-1

I create time counter using Knob:

        $(function($) {
            $(".knob").knob({
                'fgColor': '#b9e672',
                'thickness': 0.3,
                'width':150,
                'data-min': 0,
                'data-max': 30,
                'readOnly': true
            });
            var initval = 30;
            $({value: 0}).animate({value: initval},{
                duration: 10000,
                easing:'swing',
                step: function()
                {
                    $('.knob').val(this.value).trigger('change');
                }
            });
        });

I want to display counter in milliseconds, like picture: enter image description here

how to do this?

thanks,

mwafi
  • 3,946
  • 8
  • 56
  • 83
  • 2
    According to the plugin's [readme](https://github.com/aterrien/jQuery-Knob) you have to set `step` option – hindmost Oct 15 '14 at 12:01

1 Answers1

0

You can use the step option to chose the step that you would update in your knob value.

There is also another useful thing you can do, that is set the draw function. The draw function determines what gets drawn in the label. By default, it matches the value, but you don't have to.

For instance, if you want to update the knob in milliseconds, but want to round the value to display only the full seconds in the label, you could do something like:

draw: function () { $(this.i).val(Math.round(this.cv)); }

where, accordingly to the comments on the jQuery-knob source, this.cv is the "change value ; not commited value", and this.i the "mixed HTMLInputElement or array of HTMLInputElement"

Rafael Eyng
  • 4,720
  • 2
  • 33
  • 34