leora
leora

Reputation: 196871

How can I set jquery ui Dialog minwidth but have it grow larger if possible?

I want to have my jquery UI dialog at minimum 1000px width but if a person has a wide monitor then I would like it to be as wide as It can (something like window.innerWidth - 100)

Is this possible with jquery ui dialog?

Upvotes: 1

Views: 304

Answers (1)

dwitvliet
dwitvliet

Reputation: 7691

Yes. Just use the width option. See working fiddle.

$("#dialog").dialog({width: function() {
    if ($(window).width() > 1000) {
        // Wide.
        return $(window).width() - 100;
    }
    // Not wide.
    return 1000;
}});

Upvotes: 1

Related Questions