Jessica
Jessica

Reputation: 3769

Can I change the dimensions of a dialog box in the open: event?

I already created a dialog box like this:

this.dialog({
            autoOpen: false,
            modal: true,
            resizable: true,
            draggable: true,
            height: 'auto',
            width: 875,
            buttons: {
               ....<code here>
            },
            open: function (event, ui) {
                if ($(this).data('action') != "Editing HTML") {

is there some way that I could change the height and width inside the "open" to be:

    width: $(window).width() - 20,
    height: $(window).height() - 20,

If the above condition that checks "action" is met?

Upvotes: 0

Views: 69

Answers (1)

linuxeasy
linuxeasy

Reputation: 6499

Yes you can:

You can change any/most of the dialog box paramters at after initializing by:

open: function (event, ui) {   //your dialog's open callback
    $('your_selecter').dialog('option','key','value');  //key can be width or height, value can be 20 or 40
    // And then rest of your code
}

check dialog-options for more info:

Upvotes: 1

Related Questions