The maximum width of the dialog box does not affect when the width is set to auto

advertisements

I'm trying to make the dialog use auto width and height, but only up to a certain width. But the maxWidth does not take affect till I manually resize the opened dialog.

How can I automatically trigger the check for the width?

Example code: http://jsfiddle.net/yy9Cd/6/


Never done much work with jQuery UI. But here's a fix for what you've got there, obviously I've set the maxWidth to 50px, so change it!

$(document).ready(function(){

var myDialog = $("#myDialog").dialog({
    autoOpen: false,
    maxWidth: "50px",
    height: 'auto',
});

$("#showDialog").click(function(){
    myDialog.dialog("open");
});

});