对话框的位置不在网络浏览器的中心

Position of dialog box not in the center of the web browser

我正在处理以下 php 和 java 脚本,一旦弹出 label_dialog 框,它甚至会在浏览器的左上角打开虽然我把它作为中心..谁能帮忙弄清楚为什么它不在中心?

php代码:-

            <div id="label_dialog" title="Submission Details">
              <center><table border='1' align="center">
              <div id="submission_details" name="submission_details"></div>
                </table></center>
            </div>

java脚本代码:-

    $("#label_dialog").dialog({
        modal: true,
        draggable: false,
        resizable: true,
        position: ['center'],
        width: $( window ).width()*3/4,
        dialogClass: 'ui-dialog-osx',
        buttons: {
            "Edit": function() {
                $(this).dialog("close");
            },
            "Submit": function() {
                $(this).dialog("close");
                $('#submitted_gerrits_form').hide();
                $('#gerrits_form').hide();
                $("#component_form").hide();
                $("#submitted_gerrits_table").hide();
                $("#gerrits_form").hide();
                $("#check_gerrits").hide();
                $("#main_form_su_validation").hide();
                $("#contacts_form").hide();
                $("#dependencies_form").hide();
                $("#su_release_form").hide();
                $("#submission_note_form").hide();
                $("#submission").hide();

尝试删除以下行:

position: ['center'],

如果勾选docs you would see that you are not using the correct format; position needs to be an object。如果你想居中(默认),你可以使用类似的东西:

{ my: "center", at: "center", of: window }

然而,由于这是默认设置,您应该可以忽略它。

我建议从您的代码中删除 <center></center> 并使用 css 或 style-"..."