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

时间:2022-11-18 17:26:34

I have the following php and java script am working on,as soon as the label_dialog box pops-up ,it opens to the top left corner of the browser even though I have it as center..can anyone help to figure out why it is not in the center?

我正在使用以下php和java脚本,只要弹出label_dialog框,它就会打开浏览器的左上角,即使我将它作为center..can任何人都可以帮助弄清楚为什么它是不是在中心?

php code:-

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>

javascript code:-

javascript代码: -

    $("#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();

2 个解决方案

#1


1  

Try removing the line:

尝试删除该行:

position: ['center'],

If you check the docs you would see that you are not using the correct format; position needs to be an object. If you wanted to be centered (which is default), you would use something like:

如果您检查文档,您会发现您没有使用正确的格式;位置需要成为一个对象。如果你想要居中(这是默认的),你会使用类似的东西:

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

However since that's the default you should be able to just omit it.

但是,由于这是默认值,您应该可以省略它。

#2


0  

I would suggest removing <center></center> from your code and use css or style-"..."

我建议从你的代码中删除

并使用css或style - “...”

#1


1  

Try removing the line:

尝试删除该行:

position: ['center'],

If you check the docs you would see that you are not using the correct format; position needs to be an object. If you wanted to be centered (which is default), you would use something like:

如果您检查文档,您会发现您没有使用正确的格式;位置需要成为一个对象。如果你想要居中(这是默认的),你会使用类似的东西:

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

However since that's the default you should be able to just omit it.

但是,由于这是默认值,您应该可以省略它。

#2


0  

I would suggest removing <center></center> from your code and use css or style-"..."

我建议从你的代码中删除

并使用css或style - “...”