本文介绍了jQuery旋钮tron皮肤问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果以前有人使用过此插件:

If anyone has used this plugin before :

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

我试图涂抹皮肤:"tron"

im trying to apply the skin : "tron"

试图添加<input data-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"

        });

有人知道怎么了吗?

推荐答案

以防万一有人在寻找相同的答案,应该尝试一下,在演示页面中找到,但是为什么这样的代码不包含在源脚本中呢!

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;
                        }
                    }

这篇关于jQuery旋钮tron皮肤问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-09 18:41