3

I am using this Canvas Signature Pad as a user input field for signature. I found part of the code on CodePen and modified it a little bit so that I can resize the Canvas using CSS. To make the Signature and the Canvas scale properly using CSS I had to add this line of code

 canvas.width = canvas.scrollWidth;
        canvas.height = canvas.scrollHeight;
        window.addEventListener('resize', function() {
          canvas.width = canvas.scrollWidth;
          canvas.height = canvas.scrollHeight;
        });

However, every time I resize the Screen the signature disappears. Is there a way to make the Signature persist?

Machavity
  • 29,816
  • 26
  • 86
  • 96
greenn
  • 289
  • 1
  • 5
  • 17
  • Possible duplicate of [HTML5 responsive canvas: resizing the browser canvas draw disappear](https://stackoverflow.com/questions/15878377/html5-responsive-canvas-resizing-the-browser-canvas-draw-disappear) – Helder Sepulveda Sep 26 '18 at 13:17

0 Answers0