【发布时间】:2014-07-03 11:55:13
【问题描述】:
我试图增加 jquery 对话框的高度和宽度,但是当我运行程序时,高度增加得很好,但宽度没有正确增加。
这是我的程序代码
$(document).ready(function () {
$("#opener2").click(function () {
$("<div id='dialog2' />").dialog(
{
autoOpen: false,
width: 50,
height: 50,
dialogClass: 'noTitleStuff',
draggable: true,
resizable: false,
open: function (event, ui) {
}
});
$("#dialog2").dialog('open').show();
setTimeout(function () {
$("#dialog2").animate({
left: (($(window).width() - 400) / 2) + 'px',
top: (($(window).height() - 400) / 2) + 'px',
height: '400px', width: '400px'
}, 200,
function () {
});
}, 2000);
return false;
});
});
但是当我增加 height & width of .ui-dialog 而不是 #dialog2 时,我看到对话框大小适当增加,但我不想玩 .ui-dialog,这是 jquery 对话框的一部分。
所以任何人都可以建议我如何处理这种情况,因为#dialog2 高度和宽度会适当增加。
我这样排序
setTimeout(function () {
jQuery("#dialog2").dialog("widget").animate({
width: '400px',
height: '400px'
}, {
duration: 200,
step: function () {
jQuery("#dialog2").dialog('option', 'position', 'center');
}
});
}, 2000);
return false;
【问题讨论】:
标签: jquery jquery-ui jquery-dialog