jquery-modal icon indicating copy to clipboard operation
jquery-modal copied to clipboard

event.preventDefault() on BEFORE_CLOSE

Open chandramuralis opened this issue 7 years ago • 2 comments
trafficstars

Hi, @kylefox, Is it possible show confirmation screen/modal before closing the modal?

chandramuralis avatar Jul 23 '18 16:07 chandramuralis

Hmm, there is the $.modal.BEFORE_CLOSE event that fires when the modal is about to close, but I don't believe it's possible to prevent the modal from closing at this point.

You'll probably need to manually bind to the elements & events that might cause the modal to close, i.e. the click event on the close icon and/or backdrop.

kylefox avatar Jul 24 '18 02:07 kylefox

I ended up updating the modal code to fire custom event before closing the modal. Please check my code change. I'm pretty sure you can implement this in a far better way.

https://github.com/chandramuralis/jquery-modal/commit/cd28a4fc46b5bbb3aaa342ebd10ae42750682d92?diff=split

chandramuralis avatar Jul 24 '18 03:07 chandramuralis