1

At my appliction after user enter data he needs to sign, I'm using signature-pad plugin: https://github.com/szimek/signature_pad and put the signature in modal of bootstrap4.

The issue is that before I open the modal, the canvas inside it has size of 0x0 pixels, so I need to resizing the screen and initializing the library whene the modal is opened.

I tried send the modal-body when calculate the width. I put width and heigth manual - dosnt work good.

<script>
      $('#myModal').on('show.bs.modal', function (e) {
        console.log("modal open");
        resizeCanvas();
      });
 </script>
roi467
  • 100
  • 7
  • kindly share a minimal, verifiable, complete example code so that anyone from the community can easily help – Akber Iqbal Aug 08 '19 at 07:03
  • What about initializing the signature pad when the modal opens? Something like `$('#myModal').on('show.bs.modal', function (e) {var signaturePad = new SignaturePad(canvas, {/*Your settings*/});});` You could also add an if statement to see if it's allready been initialized or not. – Jeremy Aug 08 '19 at 07:08

1 Answers1

1

tnx guys, I finally got it. I gave the modal style="display:block;" and then by jq I change it

$(document).ready(function (){
            $('#myModal').css('display','none');
      });

and diabled the screen resize at signature-pad.

roi467
  • 100
  • 7