Move dialog after auto resize in jquery

I have a dialog box that displays a form with a dynamic size. I am currently getting a dialog box for automatically resizing using the following code. I would like this to happen to automatically move the dialog after a resize event. This is because the dialog box resizes its width, and I would like it to stay centered on the afterword page.

  $("#form-div").dialog({
      autoOpen: false,
      width: "auto",
      height: "auto",
      resize: "auto",
      modal: true
  });

  $("#show-form-button").click(function() {
      $("#form-div").dialog("open");
  });

Edit:

Just to be clear

. , . " : " . , .

+3
1

resizeStop . - :

$("#form-div").dialog({
      autoOpen: false,
      width: "auto",
      height: "auto",
      resize: "auto",
      modal: true,
      resizeStop: function(event, ui) {
        jQuery(this).dialog('option','position','center');
      }
 });

 $("#show-form-button").click(function() {
     $("#form-div").dialog("open");
 });
+5

Source: https://habr.com/ru/post/1774414/


All Articles