Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Canvas size responsive #268

Closed
50l3r opened this issue Jul 9, 2017 · 4 comments
Closed

Canvas size responsive #268

50l3r opened this issue Jul 9, 2017 · 4 comments

Comments

@50l3r
Copy link

50l3r commented Jul 9, 2017

Hi,

I need to create a responsive signature pad with 100% width and specific height (300px)

How can i do this?

@mihai-gritcan
Copy link

@50l3r was you able to do that ?
@szimek any suggestions please ? :) I see a PullRequest exist for that, and is old old :)
#100

@Amsvartner
Copy link

Amsvartner commented Sep 12, 2017

Afaik you can't set canvas width to a percentage, but you can place the canvas element in a container that has it's width set to 100%, then read the exact width of said parent element with jQuery. Then you can set the canvas width manually. Do this before you intialize SignaturePad.

var canvas = document.querySelector("canvas");
var parentWidth = $(canvas).parent().outerWidth();

canvas.setAttribute("width", parentWidth);

this.signaturePad = new SignaturePad(canvas);

@50l3r
Copy link
Author

50l3r commented Apr 29, 2018

Sorry for delay.

It works :)

@yokean1605
Copy link

Thanks, it works to for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants