2

私はこのようにJQuery UIダイアログを使用しています。

 $(function () {
        var dlg = $("#dialog").dialog({
            draggable: true,
            resizable: false,
            width: 950,
            height: 480,
            autoOpen: false,
            modal: true,
            minHeight: 30,
            minwidth: 30,
            title: 'test'
        });
    });

窓 :

    function PopupUrl(url, name, width, height) {
        var features = "location=1, status=1, scrollbars=1, width=" + width + ", height=" + height + '"';
        window.open(url, name, features);
    }

ダイアログはページの中央に開かれましたが、ポップアップは異なる座標で表示されます。重ねたい。これを行う方法?

4

1 に答える 1

2

計算された上と左を機能リストに追加するだけで、ポップアップが画面の中央に配置されます。

function PopupUrl(url, name, width, height) {
    var top = parseInt((screen.availHeight / 2) - (height / 2));
    var left = parseInt((screen.availWidth / 2) - (width / 2));
    var features = "location=1, status=1, scrollbars=1, width=" + width + ", height=" + height + ", top=" + top + ", left=" + left;
    window.open(url, name, features);
}
于 2012-04-30T07:45:55.603 に答える