简体   繁体   English

jQuery旋钮显示输入完成

[英]jquery knob display input on complete

I'm using jquery knob to graphically represent my data. 我正在使用jquery旋钮以图形方式表示我的数据。

https://github.com/aterrien/jQuery-Knob https://github.com/aterrien/jQuery-Knob

I'm trying to show the input value (in the center of the circle) only after the animation, but I didn't found how. 我试图仅在动画之后显示输入值(在圆心中),但是我没有找到方法。 My aproach was to initially set'displayInput' to false, and use the complete function to set it to true after the animation. 我的方法是最初将“ displayInput”设置为false,然后在动画播放后使用complete函数将其设置为true。 I can see it's working for the fgColor attribute, but not for displayInput attribute. 我可以看到它适用于fgColor属性,但不适用于displayInput属性。

elm.knob({
    'width': 60,
    'height': 60,
    'min': 0,
    'max': 6,
    'step': 0.1,
    'readOnly': true,
    'thickness': .5,
    'dynamicDraw': true,
    'displayInput': false,
    'fgColor': dangerLevelColor,
    'inputColor': '#7F8C8D',
    format: function (value) {
        return value + '/6';
    }
});
$({value: 0}).animate({value: dangerLevel}, {
    duration: 1500,
    easing: 'swing',
    progress: function () {
        elm.val(this.value).trigger('change');
    },
    complete: function () {
        elm.trigger(
                'configure', {
                    'displayInput': true,
                    'fgColor': 'green'
                });
    }
});

Any idea? 任何想法? thanks!! 谢谢!!

I was having a similar issue. 我有一个类似的问题。 Appears to be some type of bug, but I couldn't track it down. 似乎是某种类型的错误,但我无法对其进行跟踪。 It works in reverse (starting with displayInput: true and using configure to change to false later on). 它的工作方式相反(从displayInput:true开始,以后使用configure更改为false)。 What I did as a work around was set displayInput to true and use the inputColor option to 'hide' it by making it the same color as the background and setting to some other visible color when you want to show it. 我所做的工作是将displayInput设置为true,并使用inputColor选项通过使其与背景相同的颜色并将其设置为想要显示的其他可见颜色来“隐藏”它。

Initialize to Hide (on a white background) 初始化以隐藏(在白色背景上)

 $(".knob").knob({ 'inputColor': '#FFFFFF' });

Show 节目

$(".knob").trigger('configure', { 'inputColor': '#87CEEB' });

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM