Resize jquery UI dialog with JS?
Asked Answered
J

5

12

Even better would be if autoResize in latest branch would work as intended, but till then the question is simple: how to resize a dialog once it is created?

Jemmie answered 4/1, 2009 at 10:49 Comment(0)
S
20

The answer from is Soviut is correct for v1.5. 1.6 adds an option method to each plugin:

$(document).ready(function(){
    var d = $("#example").dialog();
    d.dialog("option", "width", 700);
});
Stammer answered 4/1, 2009 at 14:4 Comment(1)
I think the first dialog() call should be removed in this example.Josephinajosephine
U
4
$('#dialog').dialog().animate({width: "700px"}, 400);

I've used this for dynamically resizing dialogs.

Uranus answered 14/8, 2013 at 13:17 Comment(0)
E
2

All JQuery UI plugins can have their properties updated using .data():

$(document).ready(function(){
    var d = $("#example").dialog();
    d.data("width.dialog", 700);
});
Eula answered 4/1, 2009 at 11:47 Comment(0)
B
1

But the contents of the dialog (.ui-dialog-content) do not follow suit.

Bead answered 1/5, 2009 at 9:19 Comment(0)
K
0

I like to have the dialog sized to contents when created so I use this:

var dlg = $("#dialog");
dlg.dialog( {
    width: 600,
    height: dlg.height() + 100
    });
Knelt answered 19/1, 2010 at 18:31 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.