Page 1 of 1
Change InkSketch InkColor
Posted: 01 Aug 2017
by smithme
What is the syntax to change the InkColor of an InkSketch control?
I have tried:
$('.sketch').InkColor(clr);
And:
$('.sketch').css('color', clr);
Neither worked.
Re: Change InkSketch InkColor
Posted: 01 Aug 2017
by smithme
I found the fd_inkcolor attribute. I have tried:
var clr = $(this).css('background-color');
$('.sketch').data("fd_inkcolor", clr);
It still isn't working.
Re: Change InkSketch InkColor
Posted: 02 Aug 2017
by Nikita Kurguzov
Hello!
Simply use this code and don't forget to change CSS class to the class of your InkSketch control:
Code: Select all
$(".CSSclass").attr("fd_inkcolor", "#ff0000");
Re: Change InkSketch InkColor
Posted: 02 Aug 2017
by smithme
Of course. Thanks.
Re: Change InkSketch InkColor
Posted: 02 Aug 2017
by smithme
I used your code and it works. I can watch the dom in the browser and the fd_inkcolor is changing but when I draw on the control it still only draws in black. Is there something else I need to do for the ink color change to take effect?
Re: Change InkSketch InkColor
Posted: 03 Aug 2017
by Nikita Kurguzov
Yes, the code indeed doesn't change the pen color dynamically, it only applies when the canvas is being created.
In order to change it dynamically, please use:
Code: Select all
var signaturePad = $('.CSSclass').data('signaturePad');
signaturePad.penColor = 'rgb(66, 133, 244)';
Re: Change InkSketch InkColor
Posted: 03 Aug 2017
by smithme
This is awesome. Thank you.