Show Jquery UI Dialog on the centre of the screen

Use following on the JQuery UI dialog option when you create the dialog.

        open: function (event, ui) {
            $('position', 'fixed');
            var winheight = $(window).height();
            var winwidth = $(window).width();
            var diaheight = $(;
            var diawidth = $(;
            $('top', ((winheight-diaheight)/2).toString() + 'px');
            $('left', ((winwidth - diawidth) / 2).toString() + 'px');


Popular posts from this blog

CSS text-overflow ellipsis in the beginning of the the text - Left Ellipsis using CSS in a Flex box

Selenium With .Net

Handling Exit Event of Console Application in C#