Jquery – Make JQuery UI Dialog automatically grow HEIGHT to fit its contents (width remains static)

jqueryjquery-ui

Having looked into Make JQuery UI Dialog automatically grow or shrink to fit its contents, I am using the height: "auto" option when building a jQuery modal dialog box:

$( "#dialog-message" ).dialog({
    autoOpen: false,
    width: "400",
    height: "auto",
    show: "slide",
    modal: true,
    buttons: {
        Ok: function() {
            $( this ).dialog( "close" );
        }
    }
});

However, the height isn't "growing" to fit all of the contents. I'm still seeing a vertical scrollbar as in this image:

jQuery Modal Dialog Image

Is there a way right in the definition code I listed to ensure that the height grows enough so that a vertical scrollbar doesn't show? Or, do I need to do this programmatically before opening the dialog box?

Edit 1
Not sure why, but Chrome is displaying this fine but IE 8 isn't. I need it to specifically work in IE 8 so I believe I'm just going to put a bottom margin on the text.

Best Answer

This all I have done for the dialog box to grow automatically

$("#edit_dependent").dialog({

  autoOpen:false,

  modal:true,

  width:800,

  position:["center",20],

  minHeight:"auto"

});
Related Topic