Is there a default option to close a jQuery dialog by clicking somewhere on the screen instead of the close icon?
相关问题
- How to fix IE ClearType + jQuery opacity problem i
- jQuery add and remove delay
- Include empty value fields in jQuery .serialize()
- Disable Browser onUnload on certain links?
- how to get selected text from iframe with javascri
A bit late but this is a solution that worked for me. Perfect if your modal is inside the overlay tag. So, the modal will close when you click anywhere outside the modal content.
HTML
JS
Here is a working example
If the code of the previous posts doesn't work, give this a try:
If you have several dialogs that could be opened on a page, this will allow any of them to be closed by clicking on the background:
(Only works for modal dialogs, as it relies on '.ui-widget-overlay'. And it does close all open dialogs any time the background of one of them is clicked.)
If you'd like to do it for all dialogs throughout the site try the following code...