[thelist] Another Pop-up Question
Keith
cache at dowebs.com
Sun Nov 18 12:16:47 CST 2001
> Is there a way I can get it to open at the "top" of the screen?
Some
> of the images are kinda large and the pop-ups are opening in the
> middle of the screen, resulting in half the image off the bottom of
> the screen, or having to drag the title bar up to see it all.
Since you are intending on poping up numerous pop-ups you might
consider using only one function for the window.open and passing
the url, width, height and windowName to it for each pop-up.
You might also consider that the user's focus and mouse are
probably near the center of their screen when they launch each pop-
up. If you crunch each pop-up to the 0,0 cornor they have to adjust
both focus and mouse to deal with the pop-up. You can instead
place each pop-up centered in their screen regardless of each pop-
up's width and height.
<html><head>
<script language=javascript>
function pop(url,w,h,win){
LeftPos = screen.width ? (screen.width-w)/2 : 0;
TopPos = screen.height ? (screen.height-h)/2 : 0;
window.open(url,
win,
"scrollbars=1,top="+TopPos+",left="+LeftPos
+"screenX=0,screenY=0,"
+",width="+w+",height="+h)
}
</script>
</head>
<body>
<a
href="large.html"
onclick='pop(this.href,"500","400","large")
return false'
>large</a>
<br />
<a
href="small.html"
onclick='pop(this.href,"200","550","small")
return false'
>small</a>
</body>
</html>
I have numerous car dealer sites where users may be opening a
dozen or more pop-ups to view the car images. Dealers like to crop
the images to fit the vehicle so they may be quitedifferent in size.
Being able to center those images top to bottom and left to right
regargless of size has proven very popular with the dealers and
visitors.
keith
More information about the thelist
mailing list