Page 1 of 1

Good Centered Pop-Ups.

Posted: Sun Jun 18, 2006 7:06 pm
by oshen
does anyone know the best code for "non-automatic" popup windows?

i've done it a few way's, but none seem that great, and the dimensions seem to change depending on what computer/browser i'm on.

it would be great if the pop-window can automatically be centered in the screen too.

thanks!

Posted: Sun Jun 18, 2006 8:00 pm
by pickle
"non-automatic" = ?

Posted: Sun Jun 18, 2006 8:11 pm
by feyd
You should be able to precalculate the dimensions needed based on screen width and viewport width comparisons.. as for centering, there's a few techniques.

Posted: Sun Jun 18, 2006 11:36 pm
by Bill H
This is a script that centers the popup, sized as called, 170px down from the top of the screen.

Code: Select all

function firstWindow(report,winht,winwth)
{
     var windowX = (screen.width/2)-(winwth/2);
     s = "top=170,left="+windowX+",width="+winwth+",height="+winht;
     reportWindow = window.open(report, 'reportWin',s)
     reportWindow.focus()
}

thanks

Posted: Mon Jun 19, 2006 8:08 am
by oshen
thanks for your reply's and help.

i went with this:

http://www.violetnine.com/html/band.html

(click on the band member names)

do you think it functions alright?

the "newsletter" button on the right has the same code as well.

tom.