どのように実装すれば、自動幅が&のjQueryモーダルダイアログボックスが常にブラウザの中央に配置されます。また、ブラウザのウィンドウのサイズを変更した後。jQueryダイアログは常に中央に配置されます
次のコードは機能しません。私は問題が自動幅&の高さだと思う。
jQueryの - コード
$("<div class='popupDialog'>Loading...</div>").dialog({
autoOpen: true,
closeOnEscape: true,
height: 'auto',
modal: true,
title: 'About Ricky',
width: 'auto'
}).bind('dialogclose', function() {
jdialog.dialog('destroy');
}).load(url, function() {
$(this).dialog("option", "position", ['center', 'center']);
});
$(window).resize(function() {
$(".ui-dialog-content").dialog("option", "position", ['center', 'center']);
});
ありがとうございました!これが動作しない
margin-left:auto;margin-right:auto;
:
バインドし、左/あなた 'トップ更新します'それに応じて配置 – Chad
彼は正しい答えとしてあなたのコメントをどのようにマークできますか? :-) – Hubro
私の質問が更新されました。 – shub