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

Posted by Zack Macomber on Stack Overflow See other posts from Stack Overflow or by Zack Macomber
Published on 2012-05-02T16:32:12Z Indexed on 2012/12/09 11:09 UTC
Read the original article Hit count: 210

Filed under:
|

Having looked into How can I make a 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.

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about jquery-ui