我想使用 type="range"
输入更改蓝色,我已经做到了这一点 jsFiddle .但需要进一步的帮助,因为我不具备成功完成任务的知识。使用 jquery 或 javascript 可能/更容易吗?我通常更喜欢 jquery。
<svg id="ett">
<defs>
<filter id="f1" x="0" y="0">
<feGaussianBlur in="SourceGraphic" stdDeviation="15" />
</filter>
</defs>
<rect class="tva" filter="url(#f1)" />
</svg>
<form>
<input type="range" id="testr">
</form>
#ett{border-style:solid;
height:250px;
width:250px;}
.tva{height:250px;
width:250px;
stroke:red;
stroke-width:50px;
fill:blue;}
最佳答案
将 YOUR_CALCULATED_VALUE 下面的代码更改为计算值。它应该有效。
$("input[type=range]").change(function(){
console.log($(this).val()); // output in console current position
$(".tva").css("fill", YOUR_CALCULATED_VALUE)
})
关于jquery - 如何在类型为 ="range"的 CANVAS 中更改颜色?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42944922/