Question

I am using Knob JS and need to change the dial value and also the maximum value.

Knob is implemented as:

<input class="dial" data-max="30" data-width="225"  data-height="225">

And I change the value dynamically using:

 <script>
           function changeknobval(val){
                        $('.dial')
                        .val(val)
                        .trigger('change');
                    }

                    $(document).ready(
                                function() { changeknobval(26); });
</script>

Changing Knob value is working fine but I am lost at how to change the maximum range value. In Git repo I see this in jquery.knob.js :

this.o = $.extend(
                {
                    // Config
                    min : this.$.data('min') !== undefined ? this.$.data('min') : 0,
                    max : this.$.data('max') !== undefined ? this.$.data('max') : 100,
...

Could someone please educate me how I can change the max value?

Cheers.

Was it helpful?

Solution

According to the docs (https://github.com/aterrien/jQuery-Knob#dynamically-configure), you can do:

$('.dial').trigger('configure', {
    max: 200
});
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top