Good Centered Pop-Ups.

Ye' old general discussion board. Basically, for everything that isn't covered elsewhere. Come here to shoot the breeze, shoot your mouth off, or whatever suits your fancy.
This forum is not for asking programming related questions.

Moderator: General Moderators

Post Reply
oshen
Forum Newbie
Posts: 6
Joined: Mon Jun 12, 2006 11:36 pm

Good Centered Pop-Ups.

Post 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!
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Post by pickle »

"non-automatic" = ?
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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.
User avatar
Bill H
DevNet Resident
Posts: 1136
Joined: Sat Jun 01, 2002 10:16 am
Location: San Diego CA
Contact:

Post 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()
}
oshen
Forum Newbie
Posts: 6
Joined: Mon Jun 12, 2006 11:36 pm

thanks

Post 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.
Post Reply