jQuery - Dialog auto-resize on dynamic content and maintain center position

前端 未结 6 661
梦谈多话
梦谈多话 2020-12-30 13:51

I have a jQuery Dialog box and Am loading the content using Ajax.

The Dialog is initially in the center of the page. The problem , here is , Since its a dynamic con

6条回答
  •  感动是毒
    2020-12-30 14:14

    Positioning was fine before I moved dialog content to ajax source, after which positioning was a problem. The below worked for me today.

    $('#formdialog').dialog({autoOpen: false, modal: true, title:'Dialog Title',  
        position: {
        my: "center top", 
        at: "center top+50", 
        of: window
    }});
    

    Note that the '+50' is "50px down from the top" and works whether adding to the "my" or "at" line. Spaces not permitted. For example: "center top + 50" will not work.

    See more info in documentation option-position

提交回复
热议问题