【发布时间】:2021-07-11 21:23:53
【问题描述】:
我想在使用 jsignature 单击颜色后提供更改绘图颜色的选项。我不知道如何将颜色传递给插件。看看我是如何尝试的,请帮助知道我错在哪里。
<table>
<tr>
<td style='background:green;width:40px;height:40px;' id="green" class='changeColor'></td>
<td style='background:blue;width:40px;height:40px;' id="blue" class='changeColor'></td>
<td style='background:red;width:40px;height:40px;' id="red" class='changeColor'></td>
</tr>
</table>
<div id="signature" style="width:500;height:400"></div>
$(document).ready(function() {
//default color
var pen ='green';
$('.changeColor').on('click', function(event) {
pen = $(this).attr('id');
});
var $sigdiv = $("#signature").jSignature({
'UndoButton':true,
'background-color': 'transparent',
'decor-color': 'transparent',
'color':pen,
'width': 500,
'height': 400
});
【问题讨论】: