我有一个带有动态内容的 YUI 对话框。所以需要相应地调整高度。为此,如果我设置 height:"auto",fixedcenter:true 属性将无法正常工作。弹出窗口水平居中,但垂直它的底部边缘与视口底部对齐,在顶部留下大量空间。但是,如果我将高度设置为某个值,则一切正常,即对话框水平和垂直居中。但由于内容是动态的,我需要明确更新高度,这并不理想。
我已经检查了这些问题并尝试进行那里指定的更改,但无济于事。
http://yuilibrary.com/forum/viewtopic.php?p=6620
http://yuilibrary.com/forum/viewtopic.php?f=89&t=1004&hilit=fixedcenter
似乎(使用高度:自动)问题在于对话框高度和定位是在“setBody”调用之前计算和应用的。所以对话框不使用计算出的高度。
这是我的代码。谁能看到可能出了什么问题?
myPopup =
{
popup: null,
init: function()
{
this.popup = new YAHOO.widget.Dialog("myPopup",
{
width: "500px",
//height: "400px",
height: "auto",
zIndex: 10,
close: true,
fixedcenter: true,
visible: false,
draggable: true,
modal: true,
hideaftersubmit: true,
constraintoviewport: false,
effect: { effect: YAHOO.widget.ContainerEffect.FADE, duration: 0.10 }
});
if (YAHOO.env.ua.ie > 0)
this.popup.cfg.setProperty("iframe", true);
PluginFix.showHidePlugins(this.popup);
this.popup.setHeader("NA");
this.popup.setBody("NA");
this.popup.render(document.body);
},
onCreateClick: function()
{
if (!this.popup)
this.init();
this.popup.setBody("<div class='ajaxloader'></div>");
this.popup.setHeader("Create Notification");
this.popup.changeContentEvent.subscribe(function()
{ /* Some project specific calls here */ });
this.popup.hideEvent.subscribe(function()
{ /* Some project specific calls here */ });
this.popup.show();
var cObj = OT.Ajax.asyncRequest('GET', '/admin/NotificationDetails.aspx',
{
success: function(o)
{ myPopup.popup.setBody(o.responseText); },
failure: function(o)
{ /* TODO - error handling */ }
});
}
};