如果以前有人使用过此插件:
https://github.com/aterrien/jQuery-Knob
我正在尝试涂抹皮肤:“ tron”
尝试添加<input data-skin="tron">
但没有成功,还尝试了初始化代码:
$(".dial").knob({
readOnly:true,
thickness:0.05,
width:100,
fgColor:"#cc0000",
bgColor:"#ccc",
skin:"tron"
});
有谁知道这可能是错的吗?
最佳答案
以防万一有人在寻找相同的答案,应该尝试一下,在演示页中找到,但是为什么这样的代码不包含在源脚本中呢!
将其作为选项包括在旋钮方法中:
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;
}
}