父级的JQuery UI对话定位中心
我有一个function片段如下……
function LoadTheDialog($url) { $dialog = $(''); $dialog.html(''); $dialog.dialog({ width: 555, modal: true, resizable: false, draggable: false, open: function (type, data) { $($dialog).parent().appendTo("body"); } }).dialog('widget').position({ my: "center", at: "center", of: window, collision: "none" }); };
无论我到目前为止尝试了什么,对话框总是显示在浏览器的左上角……
我错过了一些明显的东西吗
我还想包装静态宽度和高度,并将其自动大小设置为加载的远程内容的大小,但这些选项似乎无法按预期工作……
提前致谢。
好的解决了。
你需要像这样打电话给你对话:
window.parent.jQuery(>>the html or variable of your dialog<<).dialog({ >>the options<< });
这样它就会被附加到父文档并恢复正常定位。
您是否尝试在jQuery UIDialog中设置高度。
我通过将对话框的高度和宽度设置为与iFrame相同来解决问题。
我用这个解决方案解决了这个问题:
position: {my: "center", at: "center", of: window.top}