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 di
I think you could work together with height
and maxHeight
and fit the dialog height when your div content height < dialog maxheight. Do this when the dialog is open
. Like this:
$('#dialog').dialog({
autoOpen: false,
maxHeight:400,
height:400,
buttons: {
"Cancel": function () {
$(this).dialog("close");
}
},
open:function(){
var s = $('#contents').height();
var s2 = $(this).dialog( "option", "maxHeight" );
if(s < s2){
$(this).height(s);
}
}
});
try it changing the style="height:3000px
value:
http://jsbin.com/iwecuf/2/edit