jquery - dialog won't close on background/overlay click -


many of pages have dialogs should closed when background (or overlay) clicked -- i.e. when click outside dialog. doing this code

$(document).on('click', '.ui-widget-overlay', function(){     $(".ui-dialog-titlebar-close").trigger('click'); }); 

which came jquery-ui close modal dialog on background click.

the code above on master page, , works fine every dialog have tried except one. ones close correctly (i.e. when background clicked) opened invoking following function (or similar) onclick event of control on page.

function loadpopupwindowfixedwidthandmodal(path, width) {     $("#divpopup").dialog({ title: "tip", width: width }).load(path); } 

the dialog doesn't close inside user control placed on master page, , made dialog using code

$(function () {     $("#divfindresult").dialog({         autoopen: false,         modal: false,         resizable: false,         width: 600,         position: { my: "right top", at: "right bottom+6px", of: "#findpopuppos" },         open: function (type, data) { $(this).parent().appendto("form:first"); }     }); }); 

this dialog associated find box , opened clicking on find box, using code

<asp:textbox runat="server" id="textfind" width="100" style="position:relative; z-index:100;" onclick="$('#divfindresult').dialog('open'); this.focus();" /> 

when click on find box correct dialog comes up, can closed clicking it's own close box. clicking background doesn't work. however, once dialog open, can open 1 of other dialogs, , click on background , both close.

some things have tried:

  1. added 'open: function (type, data) { $(this).parent().appendto("form:first"); }' because dialog outside of form. idea came here: http://www.worldwidewhat.net/2011/06/fixing-asp-net-control-events-in-jquery-ui-dialog.
  2. keep jqueryui overlay in same dom position
  3. jquery ui modal dialog in asp.net usercontrol: modal overlay on div in usercontrol
  4. i read jquery ui - close dialog when clicked outside, decided wouldn't help.
  5. also reviewed number of other articles.

i cannot figure out differences between 2 cases relevant, although have rejected number of theories testing different code tweaks.

one difference 1 "won't close" contents of dialog filled server side code. may relevant, @ moment don't see how.

another difference being opened event text box. again don't see how that's relevant, , it's important feature has served well. (all of coming because converting old ajaxtoolkit code jquery, can consistent. changing behavior not option.)

another difference being inside user control , on master page. matter.

it has different parameters, not use load() function, , opened separate call "creation," if that's right word. can see, grasping @ straws.

can 1 tell the right straw or branch or trunk, grateful. thank in advance. jim

the click event on .ui-widget-overlay won't work cos there no .ui-widget-overlaypresent in dom.

it because have specified modal: false. .ui-widget-overlay comes play when modal: true. is, overlay div modal dialogs.


Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -