[英]How to change the position of jquery dialog box into center?
我有一个jquery对话框,其中显示了DIV的内容。 但是问题是每当单击链接按钮时,对话框就会出现在页面底部,因为链接按钮也出现在页面底部,但是我希望它显示在页面顶部,以便用户不要必须向下滚动才能找到对话框。
这是我的aspx代码:
<a href="#" onclick="OpenDialog('#divNominees','Add Nominee')">
jQuery代码:
function OpenDialog(obj,title) {
$(obj).dialog({ title: title, modal: true })
$(obj).parent().appendTo($("form:first"));
var p = $(obj).parent();
}
如果有人帮助我,我将不胜感激,因为我已经浪费了整个上午来解决这个问题。
提前致谢。
您不要将div与其他表/ div或其他嵌套在一起。 在下面的示例中,tblOuter是我希望对话框居中的表格的ID。
$("#divNominees'").dialog({
modal: true,
position: { my: "center", at: "center", of: $("#tblOuter") },
title: "Nominees",
dialogClass: "ui-dialog-content"
});
once try with add css
margin:0 auto;
or only auto.
阅读文件
$('my-selector').dialog('option', 'position', 'center');
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.