JQ外掛程式 Knob旋鈕按鈕

2021-09-02 04:38:31 字數 1249 閱讀 4631

用法介紹:

[url=""]分享一款超棒的jquery旋鈕外掛程式 - jquery knob[/url]

[url]

我要實現的效果:

[img]

就是需要下方有乙個缺口,用於顯示一些文字。

我利用knob只顯示了這個圓環,其中的文字數字都是在div中顯示的,跟knob無關!

首先匯入jquery和knob外掛程式:

然後定義乙個div用於顯示圓環:

注意設定其中的data-angleoffset和data-anglearc,這樣乙個環就出來了,預設應該是完整的圈圈。

js**:

$(".knob").knob(,

release : function (value) ,

cancel : function () ,

draw : function ()

this.g.beginpath();

this.g.strokestyle = r ? this.o.fgcolor : this.fgcolor ;

this.g.arc(this.xy, this.xy, this.radius - this.linewidth, sat, eat, false);

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

});

最後為其動態設定value:

$(".knob").val(data.loyalty.progress_percentage).trigger("change");

data.loyalty.progress_percentage是個百分比值,根據你的需要傳入即可。

還可以試試這個外掛程式:

[url]

vue實現移動端圓形旋鈕外掛程式

最近公司有乙個專案的需要做出旋鈕的效果,旋鈕有十個檔,根據手指旋轉切換,旋轉時接近最近的檔會有吸附效果,具體效果如下 html部分 div class touch div class round box ref box touchstart touchstart touchmove touchmov...

jq 外掛程式寫法

1.一次宣告乙個函式 fn.函式名 function options fn.red function options var settings extend defaults,options this.css settings return this 2.一次宣告多個函式 fn.extend fn....

JQ 日期聯動外掛程式

jquery date selector plugin 日期聯動選擇外掛程式 demo calendar dateselector html 年 月 日 function fn.dateselector function options 初始化 this.options for var proper...