Dialog not centered

Dialog not centered

I'm using 2.1.3 on IE 11 and the dialog doesn't center itself  Here's the actual code.  Just one thing does it's to put the initialization of the dialog in a setTimeout of 500 then it works.  How can I make sure it is centered without the setTimeout ?

  1. $('#GenericDialog').dialog(
    {
        position: { my: 'center', at: 'center', of: window },
        width: 'auto',
       show: 'fade',
        hide: 'fade',
        showAnim: 'slow',
        title: 'Information de la prise',
        closeOnEscape: true,
        dialogClass: 'dialogWithDropShadow',
        close: function (event, ui) {
            $('#GenericDialog').empty();
        },
        open: function (event, ui) {
            $('#GenericDialog').dialog('option', 'position', 'center');
        }
    });
  2. $('#GenericDialog').html(HTMLPopup).promise().done(function () {
        $('#GenericDialog').find('#TakeInformationHeader').css('background', TakeDetail.HourIndicatorColor);
        $('#GenericDialog').find('#TakeInformationHeaderProductName').css('color', TakeDetail.Color);
        $('#GenericDialog').find('#TakeInformationHeaderQuantity').css('color', TakeDetail.Color);
  3.     $('#GenericDialog').find('#TakeInformationHeaderProductName').text(TakeDetail.ProductFullName);
        $('#GenericDialog').find('#TakeInformationHeaderQuantity').text('x ' + TakeDetail.ProductQuantity);
        $('#GenericDialog').find('#TakeInformationRegisteredHour').text('Administré à ' + TakeDetail.RegisteredHour);
        $('#GenericDialog').find('#TakeInformationAdministeredBy').text('par ' + TakeDetail.AdministeredBy);
        $('#GenericDialog').find('#TakeInformationAbreviation').text(TakeDetail.Abreviation + ' : ');
  4.     $(TakeDetail.IncidentDetailInfos).each(function (index, item) {
            if (item.Selected) {
                var HTMLIncident = '<p style="margin-top:0;margin-bottom:0;width:40px;float:left">' + item.Abreviation + ' : </p>' +
                                    '<p style="margin-top:0;margin-bottom:0">' + item.Description + '</p>'
  5.             $('#GenericDialog').find('#TakeInformationReactions').append(HTMLIncident);
            }
        });
    });