If you have resizing and repositioning, it can't be that difficult to perform one function:
(this is pseudo javascript, since I don't have time to polish it, so basically an idea)
function dialogResizeCentered (d,w,h){
var sw,sh;
var rx,ry;
get sw, sh from window. object
rx = parseInt(sw/2-w/2);
ry = parseInt(sh/2-h/2);
d.call resize (w,h);
d.call reposition(rx,ry);
}
and then anytime you can just call dialogResizeCentered(d,600,400);
or
Or, if you want your dialogue to remain centered, I'm sure there is something like an event to call this function window.onResize.
I hope I understood correctly :)
source
share