19

Currently (jQuery 1.4.4 and UI 1.8.8) I used the following to set a dialog's properties: (I'm trying to set the dialog to be 180px less than the height and width of the screen.)

$("#dialog").dialog({ 
            bgiframe: true,
            position: 'center',
            width: $(window).width()-180,
            height: $(window).height()-180,
            title: ititle,
            modal: true,
            buttons: { "Close": function() { $(this).dialog("destroy"); }}
});

The above works fine in FF but in IE 8 it fails.

Is this the right way to set width and height or should I be doing something differently?

2 Answers 2

16

This worked for me in IE8:

var winW = $(window).width() - 180;
var winH = $(window).height() - 180;

$( "#dialog" ).dialog({
    autoOpen: false,
    height: winH,
    width: winW,
    modal: true
});

You'll need this at the top of your page though

<!DOCTYPE html>
Sign up to request clarification or add additional context in comments.

Comments

5

You probably need to specify the DOCTYPE and use standards mode for it to work correctly.

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.