【发布时间】:2011-10-06 20:43:47
【问题描述】:
我正在使用 jQuery 并将内容加载到 div 中,然后将其显示为对话框。但是,它没有使对话框居中。
有人有解决办法吗?
代码:
function Core_Load_Register()
{
$("body").append("<div id='Register_Popup'></div>");
$("#Register_Popup").load("index.php?section=FrontPage&page=Register&nogui=true");
$("#Register_Popup").dialog({
modal: true,
height: "auto",
width: "auto",
buttons:
{
"Register New Account":
function()
{
},
"Cancel":
function()
{
$(this).dialog("close");
}
}
});
}
示例截图:
【问题讨论】:
-
试过但对我不起作用。
-
我不确定您的对话框代码在 DOM 中的位置,但我会尝试将其作为
</body>之前的最后一个元素。 -
为了它的价值,我将 jQuery UI 更新到了最新版本,它神奇地自我修复了。
标签: jquery jquery-ui jquery-ui-dialog