Don't close modal when MouseUp outside of modal
For those of you that don't want the Modal to close when you release your mouse outside of the modal, I found a fix(workaround) for it.
Fix
Search for $blocker.click in the plugin, and replace with $blocker.mousedown
This is extremely helpful if you selecting text, and sometimes doing it too quickly so the cursor is outside of the modal when releasing.
Thanks for a great plugin!
I agree that the close shouldn't be firing on mouseup - this is especially noticeable in the use case wherein users are copying something out of the modal for pasting elsewhere; the mouseup of a click & drag text selection is closing the modal.
In the meantime, I've used a workaround that doesn't require altering the code:
- Instantiate with
clickClose: false:
$(this).modal({
clickClose: false,
});
- In the
$.modal.OPENevent, add amousedownlistener to the.blocker.currentelement:
$('div.jquery-modal.blocker.current').mousedown(function(e) {
if ($(e.target).hasClass('blocker')) $.modal.close();
});