jQuery UI dialog box not positioned center screen

后端 未结 23 2938
失恋的感觉
失恋的感觉 2020-12-01 00:31

I have a jQuery dialog box that is meant to position in the middle of the screen. However, it seems slightly off-center vertically.

Here is the code:

         


        
23条回答
  •  有刺的猬
    2020-12-01 01:31

    Add this to your dialog declaration

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

    Example :

    $("#dialog").dialog({
           autoOpen: false,
            height: "auto",
            width: "auto",
            modal: true,
            position: {
                my: "center",
                at: "center",
                of: window
            }
    })
    

提交回复
热议问题