javascript - Close Dialog box when click outside -
i've read lot od asnwer how close jquery dialog box, can't of solutions posted work.
here's code.
function openpopup(element){ var = element; var dialog = $("#methods").dialog( { autoopen: false, modal: true, draggable: false, resizable: false, open: function() { $(".ui-dialog-titlebar-close").hide(); //this solution can't work $('.ui-widget-overlay').bind('click', function() { $('#methods').dialog('close'); }) } }); //open dialog dialog.dialog('open'); //set dialog position $( "#methods" ).dialog( "option", "position", { my: "left bottom", at: "left bottom", of: } ); }
and call function onclick event html code
onclick="openpopup(this);"
i think i'm missunderstanding important dialog box, can me?
one main problem .ui-widget-overlay div has no dimension inside page.
function openpopup(element){ var = element; $("#methods").dialog( { autoopen: false, modal: true, draggable: false, resizable: false, open: function( event, ui ){ $(".ui-dialog-titlebar-close").hide(); //this solution can't work $(document).on('click','.ui-widget-overlay', function() { $('#methods').dialog('close'); }); } }); }
Comments
Post a Comment