jQuery旋钮应用内部颜色
我想知道是否有人知道如何改变内圈的背景颜色jQuery旋钮应用内部颜色,jquery,css,Jquery,Css,我想知道是否有人知道如何改变内圈的背景颜色 <script> $(function($) { $(".knob").knob({ //'readOnly':true, 'fgColor':"#238eb1", 'bgColor':'#1b1b1b' }); }); </script> <div class="nob">
<script>
$(function($) {
$(".knob").knob({
//'readOnly':true,
'fgColor':"#238eb1",
'bgColor':'#1b1b1b'
});
});
</script>
<div class="nob">
<input class="knob" data-bgColor="#fff" data-width="200" data-max="1499" data-displayPrevious=true value="1250">
</div>
$(函数($){
$(“.knob”).knob({
//“只读”:正确,
'fgColor':“#238eb1”,
“bgColor”:“#1b1b”
});
});
您可以执行以下操作:
.parentElement {
background: #ccc;
border-radius: 50%;
}
检查以下代码:
$(".knob").knob({
'fgColor': 'red',
'bgColor': '#ccc000',
});
或检查以下小提琴:
我想会有帮助的。给你……谢谢上帝
$(".knob").trigger("configure", { fgColor: color }).css("color",color);
我最终直接编辑了jquery.knob.js文件(从第764行开始):
您只需要确保“填充”发生在“笔划”之前。我认为如果您在JSFIDLE中设置代码(或演示),可能会发生这种情况;你可能更容易得到这个问题的好答案。我想你可能需要改变你的父母背景,我的意思是你在哪里生成圆圈你能提供
.knob
的html吗?对于那些感兴趣的人:文档没有提到任何关于内部颜色的内容,我只需要将圆圈内的jQuery旋钮背景更改为不同的颜色。这是我在你发布此内容之前所做的:)我将你添加的代码更改为:if(This.o.innerBg){c.fillStyle=this.o.innerBg;c.fill();}
。然后,您可以调用$('.knob').knob({innerBg:'#fff'})
。
if (this.o.bgColor !== "none") {
c.beginPath();
c.strokeStyle = this.o.bgColor;
c.arc(this.xy, this.xy, this.radius, this.endAngle - 0.00001,
this.startAngle + 0.00001, true);
c.fillStyle="#fff"; // Added code to make the inner circle white
c.fill(); // Added code to make the inner circle white
c.stroke();
}