leora leora - 6 months ago 32
jQuery Question

with jquery UI dialog, is there anyway to have a max height and use 'auto' if its smaller

I want a dialog to have a max height setting but, if the content is smaller, then to shrink down to do what

height = 'auto'
does. Is this possible in JQuery UI dialog?

Answer Source

You can achieve this by doing the following:


<div id="dialog" title="Dialog Title">
    Dialog content


    resizable: false,
    minHeight: 0,
    create: function() {
        $(this).css("maxHeight", 400);        

Check out test case on jsFiddle.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download