Advertisement
Guest User

Untitled

a guest
Feb 10th, 2016
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. // Listen for document click to close non-modal dialog
  2. $(document).mousedown(function(e) {
  3. var clicked = $(e.target); // get the element clicked
  4. if (clicked.is('#dlg') || clicked.parents().is('#dlg') || clicked.is('.ui-dialog-titlebar')) {
  5. return; // click happened within the dialog, do nothing here
  6. } else { // click was outside the dialog, so close it
  7. $('#dlg').dialog("close");
  8. }
  9. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement