javascript Jquery ui对话框模态真
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/19397329/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Jquery ui Dialog Modal True
提问by user2203993
I am use jQuery v1.8.2 and jQuery UI v1.9.2.
我使用 jQuery v1.8.2 和 jQuery UI v1.9.2。
so My Problem is that.
所以我的问题是。
On Button click event i have close the dialog
在按钮单击事件上,我关闭了对话框
$('#oldInvoiceDialogDiv').dialog('close');
But Modal Property Remaining
但模态属性剩余
Means after close dialog do not working like ui-widget-overlay property Dialog
意味着关闭对话框后不像 ui-widget-overlay 属性对话框那样工作
$("#oldInvoiceDialogDiv").dialog({
autoOpen : false,
resizable : false,
width : 855,
modal : true,
close : function(ev, ui) {
}
});
so What is my Fault. Please tell me Thanks in advance
所以我的错是什么。请告诉我提前谢谢
回答by Alex Art.
If you are not doing anything in your close callback function remove it. If you do want to use it i think that this function should return Boolean at the end so try to add return true statement.
如果您没有在关闭回调函数中执行任何操作,请将其删除。如果你确实想使用它,我认为这个函数应该在最后返回布尔值,所以尝试添加 return true 语句。
EDIT
编辑
Make sure that you initialize your dialog inside document ready handler:
确保在文档就绪处理程序中初始化对话框:
$(document).ready(function(){
$("#oldInvoiceDialogDiv").dialog({
autoOpen : false,
resizable : false,
width : 200,
height:200,
modal : true,
buttons: {
"Close Dialog" : function(){
$( this ).dialog( "close" );
}
},
close : function(ev, ui) {
alert("in Close");
return true;
}
});
$('#btnOpen').click(function(){
$("#oldInvoiceDialogDiv").dialog("open");
})
});
Check this fiddle, i think it exactly your case.
检查这个小提琴,我认为这正是你的情况。