我想问为什么jQuery UI对话框自动将宽度设置为“auto”?jQuery UI对话框自动设置iframe的宽度
下面是我的iframe要构建一个对话框。
<iframe id="pklist3" class="ui-dialog-content ui-widget-content" frameborder="0" src="http://localhost/picker" style="width: 570; height: 410px; min-height: 0px;" scrolltop="0" scrollleft="0">
它具有固定的宽度和高度。但每次我调用“对话框”(“打开”)时,宽度都会自动变为“自动”。至于它的高度设置为一些固定值(我想它是由jQuery UI计算的)
当初始化对话框时,我已经设置了宽度和高度。 像这样:
var dg = {};
dg.title = this.title;
dg.autoOpen = false;
dg.modal = true;
dg.overlay = {
opacity: 0.4,
background: "#000"
};
dg.resizable = false;
$('#pklist3').dialog(dg); //iframe width is still fixed value up to this line
但经过这样的:
$('#pklist3').dialog('open'); //iframe width gets "auto" automatically
这是一个已知的行为呢?有没有一种方法可以自己定义iframe的宽度和高度?
PS。我使用jQuery UI 1.8.16和jQuery 1.6.2 ,并且当我启动对话框时,iframe的宽度不会改变。它只是我称之为后更改对话框(“公开”)
已经做到了。我再次编辑我的问题。感谢您的回应:D –
对话内容如何?它有固定的宽度吗?你也可以尝试编辑UI CSS来定义一个'min-width',但不确定它会起作用。 – yoda
:D我甚至试着用一个空的iframe。 iframe宽度仍然更改为“自动”。真的很奇怪的行为。 –