简体   繁体   English

如何放置对话框?

[英]How to position a dialog box?

I have a problem with the positioning of my dialog box it apperas always in the upper left corner it should be centered in the middle but how to do that? 我的对话框的位置一直存在问题,它总是位于左上角,应该居中居中,但是该怎么做呢?

Here is my script code: 这是我的脚本代码:

$(function() {
    $("#confirmdelete").on("click", function(e) {
        var link = this;

        e.preventDefault();

        $("<div>Soll das Kundenkonto gelöscht werden?</div>").dialog({
            buttons: {
                "Ja, bitte löschen": function() {
                    window.location = link.href;
                },
                "Nein": function() {
                    $(this).dialog("close");
                }
            }
        });
    });
});
$('<div class="dialog">Soll das Kundenkonto gelöscht werden?</div>').

.dialog {
  position: absolute;
  top: 20%;
  left: 50%;
  margin: 0 0 0 -150px;
  width: 300px;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM