0
$("#divDisplayPopUp").dialog({
                autoOpen: false,
                modal: true,
                height: 436,
                width: 939,

            });

This code doesnt align the popup into the center of the page.

And its alignment differs in Firefox, IE and Chrome.

Can anyone suggest how to align it to the centre, irrespective of browser?

Thanks.

user2598808
  • 633
  • 5
  • 22
  • 40

3 Answers3

0

Try this:

  $(function() {
    $( "#dialog" ).dialog({
      modal: true,
      autoOpen: false,
      draggable: false,
      resizable: false,
      closeText: "Close",
      height: 436,
      width: 939
    });
Abhinab Kanrar
  • 1,532
  • 2
  • 20
  • 46
0

I think this your answer.

$(document).ready(function(){ 
   var maskHeight = $(document).height();
   var maskWidth = $(window).width();

   $('#divDisplayPopUp').css('top', (maskHeight - $('#divDisplayPopUp').height()) / 2);
   $('#divDisplayPopUp').css('left', maskWidth / 2 - $('#divDisplayPopUp').width() / 2);
});

I use many times of this and never see any problem.

Hakan SONMEZ
  • 2,176
  • 2
  • 21
  • 32
0

Use jQuery UI postion.

$('#myDialog').dialog('widget').position({
    my:"center", 
    at:"center", 
    of:window
});

This Postioms your dialog in center with respect to window.

Here is the API Documentation .position()

Shaunak D
  • 20,588
  • 10
  • 46
  • 79