如果在已經顯示對話框時打開對話框,則默認情況下,第二個對話框不會超出第一個對話框的寬度。即使第二個對話框實際上並未包含在第一個對話框中(我通過單擊第一個對話框中的鏈接來獲得第二個對話框),情況也是如此。jQueryUI:調整對話框中的對話框大小?
我可以在第二個對話框上設置明確的寬度,但這並不理想。我真的希望它能自動調整大小(比如第一個/背景對話框)的內容(quasipartikel multiselect)。如果在第二個對話框上有明確的寬度,我通常會得到兩組滾動條:一個在對話框本身上,另一個在內部多選列表中。
請注意,我只嘗試在JS .dialog()調用中使用顯式寬度來調整第二個對話框的大小,而不是通過css(我幾乎不知道)。
有沒有人有任何想法如何自動調整第二個對話框?謝謝。
編輯
一些代碼加入建議:
<div id="dialog-top" title="Tab data">
<form>
...lots of stuff, including id 'addCodeButton', which
...pops up the second dialog
</form>
</div> <!-- dialog-top -->
<div id="dialog-add-code" title="Code selector">
<select id = "codes" ...etc... >
...
</select>
</div>
$(function(){
$('#addCodeButton').click(function(){
// problem: this 'open' will not set the width of the new dialog
// wider than 'dialog-top' unless an explicit width is given
// (see '460' below)
$('#dialog-add-code').dialog('open');
return false;
});
});
var $dialog = $("#dialog-top").dialog({
autoOpen: false,
modal: true,
buttons: {
...
}
});
$('#dialog-add-code').dialog({
autoOpen: false,
width: 460,
modal: false,
buttons: {
...
}
});
可能會提供一些代碼 –