2

I'm using jQuery UI dialog with an iframe:

function showDialog(url, title, refresh){           
    var horizontalPadding = 30;
    var verticalPadding = 30;
    var width = 650; height = 800;
    $('<iframe id="modalIframeId" allowtransparency="true" style="background-color:#c0c0c0;" frameborder="0"  class="ModalIFrame" src="' + url + '" />')
        .dialog({
            title: title,                
            width: width,
            height: height,
            modal: true,
            resizable: true,
            autoResize: true,
            close: function(ev, ui) {
                if(refresh)
                    location.reload();
                else
                    $(this).close();
            },
            overlay: {
                opacity: 0.7,
                background: "black"
            }
        })
        .width(width - horizontalPadding)
        .height(height - verticalPadding);  
    return false;
}

Is it possible to set width and height like window size?

thanks

3 Answers 3

4

According to the documentation you can.

(Code added since the link does not take user directly to the correct section):

OPTION - width

Initialize the dialog with the width option specified:
Code Examples:

Invoke the close method:

$( ".selector" ).dialog( "close" );

Get or set the width option, after initialization:

//Getter
var width = $( ".selector" ).dialog( "option", "width" );

//Setter
$( ".selector" ).dialog( "option", "width", 500 );
Sign up to request clarification or add additional context in comments.

Comments

1

You can get the window width and height by

var windowWidth = $(window).width();
var windowHeight = $(window).height();

and use the variables in your dialog box.

Comments

-1

Add a

height: 140,
width: 140,

in with the rest of your options

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.