jQuery knob tron skin issue

↘锁芯ラ 提交于 2019-12-11 04:40:51

问题


If anyone has used this plugin before :

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

im trying to apply the skin : "tron"

tried to add <input data-skin="tron"> but didnt work , also tried in the initialization code:

$(".dial").knob({       
        readOnly:true,
        thickness:0.05,
        width:100,
        fgColor:"#cc0000",
        bgColor:"#ccc",
        skin:"tron"

        });

anyone knows what might be wrong ?


回答1:


just in case anyone was searching for same answer , should try this , found in the demo page , dont why such code is not included in the source script though !

include this as option in the knob method:

draw : function () {

                        // "tron" case
                        if(this.$.data('skin') == 'tron') {

                            this.cursorExt = 0.3;

                            var a = this.arc(this.cv)  // Arc
                                , pa                   // Previous arc
                                , r = 1;

                            this.g.lineWidth = this.lineWidth;

                            if (this.o.displayPrevious) {
                                pa = this.arc(this.v);
                                this.g.beginPath();
                                this.g.strokeStyle = this.pColor;
                                this.g.arc(this.xy, this.xy, this.radius - this.lineWidth, pa.s, pa.e, pa.d);
                                this.g.stroke();
                            }

                            this.g.beginPath();
                            this.g.strokeStyle = r ? this.o.fgColor : this.fgColor ;
                            this.g.arc(this.xy, this.xy, this.radius - this.lineWidth, a.s, a.e, a.d);
                            this.g.stroke();

                            this.g.lineWidth = 2;
                            this.g.beginPath();
                            this.g.strokeStyle = this.o.fgColor;
                            this.g.arc( this.xy, this.xy, this.radius - this.lineWidth + 1 + this.lineWidth * 2 / 3, 0, 2 * Math.PI, false);
                            this.g.stroke();

                            return false;
                        }
                    }



回答2:


Even its a very late answer, you can use the jQuery roundSlider plugin where you can achive the tron skin with simple CSS customization.

Check the below demo:

Demo - JSFiddle

Screenshot:



来源:https://stackoverflow.com/questions/22810583/jquery-knob-tron-skin-issue

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!