動的コンテンツを含む YUI ダイアログがあります。したがって、高さはそれに応じて調整する必要があります。そのため、height:"auto" を設定すると、fixedcenter:true プロパティが正しく機能しません。ポップアップは水平方向に中央に配置されますが、垂直方向には下端がビューポートの下部に揃えられ、上部に多くのスペースが残ります。ただし、高さを何らかの値に設定すると、うまく機能します。つまり、ダイアログは水平方向と垂直方向の両方で中央に配置されます。しかし、コンテンツは動的であるため、高さを明示的に更新する必要がありますが、これは理想的ではありません。
これらの質問を確認し、そこに指定されている変更を試みましたが、役に立ちませんでした。
http://yulibrary.com/forum/viewtopic.php?p=6620
http://yulibrary.com/forum/viewtopic.php?f=89&t=1004&hilit=fixedcenter
(height:auto で) 問題は、ダイアログの高さと位置が計算され、「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 */ }
});
}
};