Are you in an iframe? I have an app that renders in an iframe so the modal window is off centre. Actually its off vertical viewport centre as well so I recentre it (vertically). If this sounds like your case, you can adapt this javascript and call it after window.show().
/* fix vertical issue with Wicket Modal window in an iframe. puts it 50px below
top of viewport rather than vertically centered. */
function fixWindowVertical() {
var myWindow=Wicket.Window.get();
if(myWindow) {
var top = getScroll() + 50;
myWindow.window.style.top = top + "px";
}
return false;
}
/* helper for fixWindowVertical: get how far the window has been scrolled down
the page */
function getScroll() {
if (document.all) {
// We are In MSIE.
return top.document.documentElement.scrollTop;
} else {
// In Firefox
return top.pageYOffset;
}
}
cheers,
Steve
On 21/01/2010, at 8:45 AM, Alex Shapovalov wrote:
> As a part of my application I needed to implement a modal window in
> wicket. Everything works great except the modal window (once displayed
> on screen) is placed off-center toward the right side of the screen.
> I've searched google and can't seem to find anyone with a similar
> problem. Could someone please suggest what might be causing this
> behavior. I hope I don't have to override wicket's JavaScript that
> centers the modal window.
>
> Thank you all.
> Alex Shapovalov.
smime.p7s
Description: S/MIME cryptographic signature
