【问题标题】:Knob JS: Change data-max value dynamically旋钮 JS:动态更改数据最大值
【发布时间】:2014-05-15 14:49:10
【问题描述】:

我正在使用 Knob JS,需要更改表盘值和最大值。

旋钮实现为:

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

我使用以下方法动态更改值:

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

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

更改旋钮值工作正常,但我不知道如何更改最大范围值。 在 Git 存储库中,我在 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,
...

有人可以教我如何更改最大值吗?

干杯。

【问题讨论】:

标签: jquery jquery-knob


【解决方案1】:

根据文档 (https://github.com/aterrien/jQuery-Knob#dynamically-configure),您可以:

$('.dial').trigger('configure', {
    max: 200
});

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-11-04
    • 2016-05-21
    • 2017-02-25
    • 1970-01-01
    • 2022-01-02
    • 1970-01-01
    相关资源
    最近更新 更多