popups relative to resolution?

L

Lee Mundie

Hi,
Does anyone know where I can get a script for a pop-up where I can
control fixed positioning of a popup based on browser resolution?

two res's: 800 x 600 and 1024 x 768

Thanks in advance

Lee
 
F

Fabian

Lee Mundie hu kiteb:
Hi,
Does anyone know where I can get a script for a pop-up where I can
control fixed positioning of a popup based on browser resolution?

two res's: 800 x 600 and 1024 x 768

What about where the browser is not maximised?
 
L

Lasse Reichstein Nielsen

Lee Mundie said:
Does anyone know where I can get a script for a pop-up where I can
control fixed positioning of a popup based on browser resolution?

two res's: 800 x 600 and 1024 x 768

Those are screen resolutions, not browser resolutions. My browser
typically takes up ~900x1000 on a 1600x1200 screen. Since it is an MDI
client, new popups cannot be larger than the visible area of the
browser viewport (~900x900) and cannot be placed outside those bounds
either.

So, don't use screen resolution, it's not relevant to the task. And be very
careful when positioning new windows, since there are several cases where
your attempts fail badly.

With that being said, you position new windows created with
window.open using the third argument. Example:

var win = window.open("someURL.html","windowName",
"width=400,height=300,top=100,left=120,resizable=yes");

Making the position depend on screen resolution (bad choice!) would be:

---
var left=120,top=100;
if (screen.width == 800) {
left = 300;
top = 200;
} else if (screen.width == 1024) {
left = 500;
top = 300;
}
var win = window.open("someURL.html","windowName",
"width=400,height=300," +
"top=" + top + ",left=" + left + ",resizable=yes");
---

You can read more here:
<URL:http://www.infimum.dk/HTML/JSwindows.html#ref_3_2>

/L
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,079
Latest member
ElidaWarin

Latest Threads

Top