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) {
$(event.target).parent().css('position', 'fixed');
var winheight = $(window).height();
var winwidth = $(window).width();
var diaheight = $(event.target).parent().height();
var diawidth = $(event.target).parent().width();
$(event.target).parent().css('top', ((winheight-diaheight)/2).toString() + 'px');
$(event.target).parent().css('left', ((winwidth - diawidth) / 2).toString() + 'px');
},
open: function (event, ui) {
$(event.target).parent().css('position', 'fixed');
var winheight = $(window).height();
var winwidth = $(window).width();
var diaheight = $(event.target).parent().height();
var diawidth = $(event.target).parent().width();
$(event.target).parent().css('top', ((winheight-diaheight)/2).toString() + 'px');
$(event.target).parent().css('left', ((winwidth - diawidth) / 2).toString() + 'px');
},
Comments
Post a Comment