问题
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