家长的JQuery UI对话框定位中心 [英] JQuery UI Dialog Positioning Center of Parent
本文介绍了家长的JQuery UI对话框定位中心的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个功能片段如下...
I have a functioning snippet as follows...
function LoadTheDialog($url) {
$dialog = $('<div></div>');
$dialog.html('<iframe id="theDialog" src="' + $url + '" width="530px" height="600px" style="border: 0px;"></iframe>');
$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" });
};
无论我到目前为止尝试过,对话框总是显示在浏览器的左上角。
no matter what I have tried thus far, the dialog always shows up at top left of the browser...
我是否缺少一些明显的东西?
Am I missing something obvious?
我还想包装静态宽度&高度,并将其自动调整为加载的远程内容的大小,但这些选项似乎没有按预期的方式工作...
I would also like to bag the static width & height and have it auto size to the size of the loaded remote content but those options do not seem to work as anticipated either...
提前感谢。
推荐答案
确定解决
你需要像这样打电话给你: / p>
You need to call you dialog like this:
window.parent.jQuery(>>the html or variable of your dialog<<).dialog({ >>the options<< });
,以便将其附加到父文档并恢复正常定位。
so that way it gets appended to the parent document and gets back to normal positioning.
这篇关于家长的JQuery UI对话框定位中心的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文