我该如何实现,自动调整宽度为&的jQuery模式对话框始终居中在浏览器中。在调整浏览器窗口的大小之后。jQuery对话框始终居中
以下代码不起作用。我认为问题是自动宽度为&高度。
的jQuery - 代码
$("<div class='popupDialog'>Loading...</div>").dialog({
autoOpen: true,
closeOnEscape: true,
height: 'auto',
modal: true,
title: 'About Ricky',
width: 'auto'
}).bind('dialogclose', function() {
jdialog.dialog('destroy');
}).load(url, function() {
$(this).dialog("option", "position", ['center', 'center']);
});
$(window).resize(function() {
$(".ui-dialog-content").dialog("option", "position", ['center', 'center']);
});
谢谢!
绑定'resize'事件的'window'并更新你的'顶/左'相应地定位 – Chad
他怎么能把你的评论标记为正确的答案,我想知道? :-) – Hubro
我更新了我的问题。 – shub