JQuery UI Dialog Animation Automatically Changes

I have a dialog with a dynamic form inside that can increase the height of the dialog. autoResize set to true, width is 500. Is there a way to resize the dialog when adding more content?

+6
source share
3 answers

Initially, I used .show('fade') , and the size of the dialog box turned on when .show called. When using the .show('fast') or .show('slow') effect, the dialog is resized with a resizing that works for me.

+4
source

Animation in the middle of the screen.

 jQuery("#dialog").dialog("widget").animate({ width: '400px', height: '110px' }, { duration: 500, step: function() { jQuery("#dialog").dialog('option', 'position', 'center'); } }); 
+15
source

When I used the @Steven answer, I have problems with the size of the content, like @jedierikb in the comment. So I created this code and it works.

 $(dialogSel).dialog("widget").animate({ width: 100, height: 200 }, { duration: 200, step: function (now, tween) { if (tween.prop == "width") { $(dialogSel).dialog("option", "width", now); } else { $(dialogSel).dialog("option", "height", now); } } }); 
+1
source

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


All Articles