Setting the maximum height of the dialog, then allowing scrolling

I can't figure out how to set the height for the jquery ui dialog correctly.

I want it to display height, although there is a lot of content present, but if it exceeds 400 pixels, then I want a scroll bar.

So, if the content is 200 pixels high, then the dialog should have a height of 200 pixels.

If the content has a height of more than 400 pixels, then the dialog should not expand to 400 pixels, and the scroll bar should be visible.

I still have this:

$("#popup").dialog({
            modal: true,
            autoOpen: false

});
+5
source share
1 answer
$("#popup").dialog({
            modal: true,
            autoOpen: false
});

CSS

#popup {
 border: 1px solid #ccc;
 border-radius: 4px;
 padding: 10px;
 overflow: auto;
 max-height: 300px;   
}​

Working violin

, . , , jQuery maxHeight, , , . CSS, .

+10

All Articles