1
我有现在设置为特定高度的jQuery UI的对话框:自动调整大小jQuery的对话框
$(".event").click(function() {
var id=$(this).attr("data-id");
$("<div></div>")
.addClass("modal-dialog")
.appendTo("body")
.dialog({
close: function() { $(this).remove(); },
modal: true,
height: 600,
width: 700
})
.load("/Home/users?xid=" + id);
});
我想为我的对话框取决于它的内容调整它的高度。 我试图更改为height: auto
,但它根本无法打开。
我也发现此线程: Automatically resize jQuery UI dialog to the width of the content loaded by ajax 但我不明白如何将它应用到我自己的代码。
这是非常好的,它的工作。只是一件事。使用这段代码,对话框在页面上打开的很少。我有办法决定我想放置在哪里吗? 没有足够的代表upvote,但非常感谢! – Wranglerino 2014-10-30 07:22:52
http://api.jqueryui.com/dialog/#option-position您可以在设置高度时将位置设置回默认值。 – Scimonster 2014-10-30 07:26:02