468,309 Members | 1,087 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,309 developers. It's quick & easy.

Centering a PopUp Window Help

Hi,

I'd like to append/amend the following code from the Dreamweaver extension
"Open Picture Window Fever" for the ability to center the PopUp window:

By default, it allows the window to be offset on the left and top, but does
not include a centering option.

I'm thinking it would include something like (screen.width-imageWidth)/2;
somewhere but not sure how do go about doing this.

Thanks for any help!

______________
function
openPictureWindow_Fever(imageType,imageName,imageW idth,imageHeight,alt,posLe
ft,posTop) { // v4.01

newWindow =
window.open("","newWindow","width="+imageWidth+",h eight="+imageHeight+",scro
llbars=no,left="+posLeft+",top="+posTop);
newWindow.document.open();
newWindow.document.write('<html><title>'+alt+'</title><body
bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginheight="0"
marginwidth="0" onBlur="self.close()">');

if (imageType == "swf"){
newWindow.document.write('<object
classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\"
codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.c
ab#version=5,0,0,0\" width=\"'+imageWidth+'\" height=\"'+imageHeight+'\">');
newWindow.document.write('<param name=movie value=\"'+imageName+'\"><param
name=quality value=high>');
newWindow.document.write('<embed src=\"'+imageName+'\" quality=high
pluginspage=\"http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod
_Version=ShockwaveFlash\" type=\"application/x-shockwave-flash\"
width=\"'+imageWidth+'\" height=\"'+imageHeight+'\">');
newWindow.document.write('</embed></object>'); }else{
newWindow.document.write('<img src=\"'+imageName+'\" width='+imageWidth+'
height='+imageHeight+' alt=\"'+alt+'\">'); }
newWindow.document.write('</body></html>');
newWindow.document.close();
newWindow.focus();
}
Jul 23 '05 #1
17 2288
Applebrownbetty wrote:
Hi,

I'd like to append/amend the following code from the Dreamweaver extension
"Open Picture Window Fever" for the ability to center the PopUp window:
Ditch it and start over.
By default, it allows the window to be offset on the left and top, but does
not include a centering option.
Nah, it just thinks it can offset windows on my PC.
I'm thinking it would include something like (screen.width-imageWidth)/2;
somewhere but not sure how do go about doing this.


First, ask yourself what makes anybody think that I want a popup window
that is in the center of my desktop? My desktop is 2560 pixels wide, so
the popup window would sit (or attempt to sit) in between the two monitors.

Open a window, let the *user* decide where to put it.
--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq
Jul 23 '05 #2
Randy Webb wrote:
Open a window, let the *user* decide where to put it.


Well, open a window[1], then let the user's probably-pretty-reasonable
window manager deal with it (and let the user move it from there if they
like)
[1] Or don't - thanks to popup blockers and people simply training
themselves to hit the X before the content loads, they aren't exactly
effective these days.

--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
Jul 23 '05 #3
"Randy Webb" <Hi************@aol.com> wrote in message
news:5P********************@comcast.com...
Applebrownbetty wrote:
Hi,

I'd like to append/amend the following code from the Dreamweaver extension "Open Picture Window Fever" for the ability to center the PopUp window:
Ditch it and start over.


Why?
By default, it allows the window to be offset on the left and top, but does not include a centering option.
Nah, it just thinks it can offset windows on my PC.


Obviously you mean something here... but lack the time/energy/patience to
write it outright (in which case you shouldn't have posted it), so I'll skip
it.

I'm thinking it would include something like (screen.width-imageWidth)/2; somewhere but not sure how do go about doing this.

First, ask yourself what makes anybody think that I want a popup window
that is in the center of my desktop?
My answer is that it is an enlarged thumbnail image, and on a big desktop it
would mean less mouse movement if it were near the center where the
thumbnails are as opposed to the left corner where most of them popup.
My desktop is 2560 pixels wide, so
the popup window would sit (or attempt to sit) in between the two monitors.

And the percentage of people in your situation is? Right, less than 0.5% I'd
guess. This might be a problem if you weren't able to move it yourself...
but even if it was in the center, you could.
Open a window, let the *user* decide where to put it.
Whether it opens in the top left or center, it does let the user decide
where to put it, since it's movable. I aim to create the least frustration
for the user. When they click on an image and it pops up nearby, that's more
user friendly and looks better IMO than an image on the top left of the big
monitor. It's framed nicer.


--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq

Jul 23 '05 #4
On Mon, 01 Nov 2004 19:24:02 GMT, Applebrownbetty
<applebrown@deletethisspace_gamebanshee.com> wrote:
"Randy Webb" <Hi************@aol.com> wrote in message
news:5P********************@comcast.com...
[snip]
Ditch it and start over.


Why?


Most code produced by Dreamweaver is, quite frankly, crap. This extension,
included.

[ABB:]
By default, it allows the window to be offset on the left and top, but
does not include a centering option.


Nah, it just thinks it can offset windows on my PC.


Obviously you mean something here... but lack the time/energy/patience
to write it outright [...]


I think the meaning is fairly explicit. The code attempts to position the
window, but it may not succeed. After all, browsers do allow the user to
override certain script actions.

[snip]
My answer is that it is an enlarged thumbnail image, and on a big
desktop it would mean less mouse movement if it were near the center
where the thumbnails are as opposed to the left corner where most of
them popup.
As Randy has demonstrated, it will *force* extra mouse movement for a
proportion of users.
My desktop is 2560 pixels wide, so the popup window would sit (or
attempt to sit) in between the two monitors.


And the percentage of people in your situation is?


It doesn't really matter. From my experience, if the window manager
positions it, it will be placed in (generally) a predictable position in
the most applicable monitor. If you position it, it may be placed where
the user expects it, or somewhere inappropriate. So, a sensible place 100%
of the time, or an awkward place some of the time? I know what would be
the logical answer to that.

[snip]
I aim to create the least frustration for the user.


As I hope I've just made clear, leaving the decision to the operating
system will create the least frustration. Of course, not forcing a new
window upon the user in the first place is truly in the user's best
interests.

[snip]

Mike

--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.
Jul 23 '05 #5
Michael Winter wrote:

Most code produced by Dreamweaver is, quite frankly, crap. This
extension, included.


This isn't produced by DW, it's the work of a third party developer.
Mick
Jul 23 '05 #6
Applebrownbetty wrote:
"Randy Webb" <Hi************@aol.com> wrote in message
news:5P********************@comcast.com...
Applebrownbetty wrote:

Hi,

I'd like to append/amend the following code from the Dreamweaver
extension
"Open Picture Window Fever" for the ability to center the PopUp window:
Ditch it and start over.

Why?


Because every single snippet of DW generated code I have ever read is
utter junk and can be re-written to be more readable, more predictable,
and less error-prone.
By default, it allows the window to be offset on the left and top, but
does
not include a centering option.
Nah, it just thinks it can offset windows on my PC.

Obviously you mean something here... but lack the time/energy/patience to
write it outright (in which case you shouldn't have posted it), so I'll skip
it.


No need to skip it. I will explain what isn't obvious to you. You can't
specify where to open a window on my computer because I have explicitly
disabled it. I have my windows where *I* want them, and thats where they
will open.

I'm thinking it would include something like
(screen.width-imageWidth)/2;
somewhere but not sure how do go about doing this.

First, ask yourself what makes anybody think that I want a popup window
that is in the center of my desktop?

My answer is that it is an enlarged thumbnail image, and on a big desktop it
would mean less mouse movement if it were near the center where the
thumbnails are as opposed to the left corner where most of them popup.


So you think that opening a window where the user is not used to it
being opened is advantageous? I don't.
My desktop is 2560 pixels wide, so
the popup window would sit (or attempt to sit) in between the two
monitors.

And the percentage of people in your situation is? Right, less than 0.5% I'd
guess. This might be a problem if you weren't able to move it yourself...
but even if it was in the center, you could.


It can't be opened in the center but thats irrelevant. Let it open where
the user is accustomed to it opening and it totally removes your "problem".
Open a window, let the *user* decide where to put it.

Whether it opens in the top left or center, it does let the user decide
where to put it, since it's movable. I aim to create the least frustration
for the user. When they click on an image and it pops up nearby, that's more
user friendly and looks better IMO than an image on the top left of the big
monitor. It's framed nicer.


So its more "user friendly" to open a window where they don't expect it?
I think not.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq
Jul 23 '05 #7

"Michael Winter" <M.******@blueyonder.co.invalid> wrote in message
news:opsgs0utmvx13kvk@atlantis...
On Mon, 01 Nov 2004 19:24:02 GMT, Applebrownbetty
<applebrown@deletethisspace_gamebanshee.com> wrote:
"Randy Webb" <Hi************@aol.com> wrote in message
news:5P********************@comcast.com...
[snip]
Ditch it and start over.


Why?


Most code produced by Dreamweaver is, quite frankly, crap. This extension,
included.


That really didn't answer my question about this particular bit of code.

[ABB:]
By default, it allows the window to be offset on the left and top, but
does not include a centering option.

Nah, it just thinks it can offset windows on my PC.
Obviously you mean something here... but lack the time/energy/patience
to write it outright [...]


I think the meaning is fairly explicit. The code attempts to position the
window, but it may not succeed. After all, browsers do allow the user to
override certain script actions.

[snip]
My answer is that it is an enlarged thumbnail image, and on a big
desktop it would mean less mouse movement if it were near the center
where the thumbnails are as opposed to the left corner where most of
them popup.


As Randy has demonstrated, it will *force* extra mouse movement for a
proportion of users.
My desktop is 2560 pixels wide, so the popup window would sit (or
attempt to sit) in between the two monitors.


And the percentage of people in your situation is?


It doesn't really matter. From my experience, if the window manager
positions it, it will be placed in (generally) a predictable position in
the most applicable monitor. If you position it, it may be placed where
the user expects it, or somewhere inappropriate. So, a sensible place 100%
of the time, or an awkward place some of the time? I know what would be
the logical answer to that.


What it comes down to is that you're saying 99% of the people who use window
positioning should not be. I don't agree. Let the operating system become
more reliable. I'll chance it for the few it doesn't work for. If it looks
really good for 99% of the people as opposed to "is functional" for 100% of
the people, I'll choose the former.
[snip]
I aim to create the least frustration for the user.


Of course, not forcing a new
window upon the user in the first place is truly in the user's best
interests.


Who said anything about forcing? These are thumbnails. If they want to view
a larger image, it's their choice. Besides, most people are familiar with
maneuvering windows that they decide to open... hence the operating system
name.
Jul 23 '05 #8
"Randy Webb" <Hi************@aol.com> wrote in message
news:rM********************@comcast.com...
Applebrownbetty wrote:
"Randy Webb" <Hi************@aol.com> wrote in message
news:5P********************@comcast.com...
Applebrownbetty wrote:
Hi,

I'd like to append/amend the following code from the Dreamweaver


extension
"Open Picture Window Fever" for the ability to center the PopUp window:

Ditch it and start over.

Why?


Because every single snippet of DW generated code I have ever read is
utter junk and can be re-written to be more readable, more predictable,
and less error-prone.
By default, it allows the window to be offset on the left and top, but


does
not include a centering option.

Nah, it just thinks it can offset windows on my PC.

Obviously you mean something here... but lack the time/energy/patience to write it outright (in which case you shouldn't have posted it), so I'll skip it.


No need to skip it. I will explain what isn't obvious to you. You can't
specify where to open a window on my computer because I have explicitly
disabled it. I have my windows where *I* want them, and thats where they
will open.

I'm thinking it would include something like


(screen.width-imageWidth)/2;
somewhere but not sure how do go about doing this.

First, ask yourself what makes anybody think that I want a popup window
that is in the center of my desktop?

My answer is that it is an enlarged thumbnail image, and on a big desktop it would mean less mouse movement if it were near the center where the
thumbnails are as opposed to the left corner where most of them popup.


So you think that opening a window where the user is not used to it
being opened is advantageous? I don't.


And I agree with you. However, your implication that having a window open in
the center is "unfamiliar" to users is false in my opinion. If anything, it
is more plainly seen and not overlooked, which, if they bother clicking on a
thumbnail, IS advantageous.
My desktop is 2560 pixels wide, so
the popup window would sit (or attempt to sit) in between the two


monitors.

And the percentage of people in your situation is? Right, less than 0.5% I'd guess. This might be a problem if you weren't able to move it yourself... but even if it was in the center, you could.


It can't be opened in the center but thats irrelevant. Let it open where
the user is accustomed to it opening and it totally removes your

"problem".

Not really. My "problem" was aesthetic (which as we all know is subjective
so please don't try and argue which way is better aesthetically) combined
with functionality. My last paragraph states what I was looking for.
Open a window, let the *user* decide where to put it.

Whether it opens in the top left or center, it does let the user decide
where to put it, since it's movable. I aim to create the least frustration for the user. When they click on an image and it pops up nearby, that's more user friendly and looks better IMO than an image on the top left of the big monitor. It's framed nicer.


So its more "user friendly" to open a window where they don't expect it?
I think not.


See above.
Jul 23 '05 #9
On Tue, 02 Nov 2004 04:41:34 GMT, Applebrownbetty
<applebrown@deletethisspace_gamebanshee.com> wrote:

[snip]
If it looks really good for 99% of the people as opposed to "is
functional" for 100% of the people, I'll choose the former.


You quoted the main point of my post (below), yet you seem to ignore it.
Most people do not like new windows, no matter where they are positioned.
Years of abuse have turned them into things of irritation, and
irrespective of that fact, they aren't viewed as the most user-friendly
feature.

[snip]
Of course, not forcing a new window upon the user in the first place is
truly in the user's best interests.


Who said anything about forcing?


You did, the moment you started opening new windows. If the user wants to
view the image, you are forcing them to see it in a new window. Whether
the user might want that or not, they have no choice in the matter. Your
alternative, don't view the image, is hardly useful, is it.

Every graphical browser I have ever used[1] allows the user to open any
link in a new window. Modern browsers make this very simple for users with
three-button mice. It's not like you're providing something that browsers
can't do themselves.

[snip]

Mike
[1] I can think of seven by name.

--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.
Jul 23 '05 #10

"Michael Winter" <M.******@blueyonder.co.invalid> wrote in message
Most people do not like new windows, no matter where they are positioned.
Years of abuse have turned them into things of irritation, and
irrespective of that fact, they aren't viewed as the most user-friendly
feature.
And what source do you have for "most people do not like new windows"? Most
people I'd wager are still used to thumbnails opening up, no? That is the
essense of this thread, so if you're talking generalities, it's off topic.
[snip]
Of course, not forcing a new window upon the user in the first place is
truly in the user's best interests.
Who said anything about forcing?


You did, the moment you started opening new windows. If the user wants to
view the image, you are forcing them to see it in a new window.


And if you put them inline with CSS, your "forcing" them to download the
larger picture right? Which is preferable? Either way, you're "forcing" the
viewer to view the page how you want them to, the moment you start writing
HTML.
Whether
the user might want that or not, they have no choice in the matter. Your
alternative, don't view the image, is hardly useful, is it.

Every graphical browser I have ever used[1] allows the user to open any
link in a new window.


Again, we are talking about thumbnails. See above.
Jul 23 '05 #11
Applebrownbetty wrote:
"Randy Webb" <Hi************@aol.com> wrote in message
news:rM********************@comcast.com...
Applebrownbetty wrote:

>I'm thinking it would include something like

(screen.width-imageWidth)/2;
>somewhere but not sure how do go about doing this.

First, ask yourself what makes anybody think that I want a popup window
that is in the center of my desktop?
My answer is that it is an enlarged thumbnail image, and on a big desktop it
would mean less mouse movement if it were near the center where the
thumbnails are as opposed to the left corner where most of them popup.
So you think that opening a window where the user is not used to it
being opened is advantageous? I don't.

And I agree with you. However, your implication that having a window open in
the center is "unfamiliar" to users is false in my opinion. If anything, it
is more plainly seen and not overlooked, which, if they bother clicking on a
thumbnail, IS advantageous.


If you open your browser, open a website, right click a link and open in
a new window, or click a link with a target attribute, or open a window
with window.open, Its going to open in the same predictable location
every time. Once you start moving that window, you have just caused your
users to scratch there heads and ask "What the hell just happened?".
And, "Why isn't it where I expect it to be?". That is not just me, its
human nature. You get used to things being where they are and when they
aren't there, it confuses. And the moving of windows is precisely why I
have it disabled.

My desktop is 2560 pixels wide, so the popup window would sit
(or attempt to sit) in between the two monitors.

And the percentage of people in your situation is? Right, less than 0.5%
I'd guess. This might be a problem if you weren't able to move it yourself...
but even if it was in the center, you could.


It can't be opened in the center but thats irrelevant. Let it open where
the user is accustomed to it opening and it totally removes your "problem".


Not really. My "problem" was aesthetic (which as we all know is subjective
so please don't try and argue which way is better aesthetically) combined
with functionality. My last paragraph states what I was looking for.

<quote>
I'd like to append/amend the following code from the Dreamweaver
extension "Open Picture Window Fever" for the ability to center the
PopUp window:
</quote>

That is the first line of your original post. From that statement, you
want to center a popup. Stop trying to center the popup and that
"problem" goes away.

This is your last paragraph before your code:
<quote>
I'm thinking it would include something like (screen.width-imageWidth)/2;
somewhere but not sure how do go about doing this.
</quote>

What exactly happens when you try that? Or did you even try?

And no, I am not going to try to wade through some DW crap code to
figure out what its trying to do (DW code nor any add-on code).

To get the top of the window, use screen.height.

When you get it all worked out, its easier and more reliably to attempt
to let the popup resize itself and move itself. It can know its
dimensions a lot easier.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq
Jul 23 '05 #12
On Tue, 02 Nov 2004 16:33:18 GMT, Applebrownbetty
<applebrown@deletethisspace_gamebanshee.com> wrote:

[snip]
And what source do you have for "most people do not like new windows"?
The number of search results returned on the subject seems to suggest a
trend, but also one of the best-known people in the field of
human-computer interaction, Jakob Nielsen.
Most people I'd wager are still used to thumbnails opening up, no?
Really? I see quite a mixture.

[snip]
If the user wants to view the image, you are forcing them to see it in
a new window.


And if you put them inline with CSS, your "forcing" them to download the
larger picture right? [...]


Huh? Where did that come from? No, you link to the image. The user can
then choose to open the image in a new window, or replace the current
content and later use the Back button.
Either way, you're "forcing" the viewer to view the page how you want
them to, the moment you start writing HTML.


What kind of nonsense statement is that? Of course you have to suggest
some form of layout for the document, but as long your decisions are
remotely sensible, a layout isn't even comparible to forcing an obtrusive
new window on the user.

[snip]
Every graphical browser I have ever used[1] allows the user to open any
link in a new window.


Again, we are talking about thumbnails. See above.


How does my comment not apply?

You seem to be more interested in what *you* want. If that's the case,
please don't waste the time of either one of us by replying.

Mike

--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.
Jul 23 '05 #13
On Tue, 02 Nov 2004 16:33:18 GMT, Applebrownbetty wrote:
...That is the
essense of this thread, so if you're talking generalities, it's off topic.


Generalities regarding web-useability are *always* on topic
when the technology at hand can impact on same.

--
Andrew Thompson
http://www.PhySci.org/codes/ Web & IT Help
http://www.PhySci.org/ Open-source software suite
http://www.1point1C.org/ Science & Technology
http://www.LensEscapes.com/ Images that escape the mundane
Jul 23 '05 #14

"Michael Winter" <M.******@blueyonder.co.invalid> wrote in message
news:opsguq5acgx13kvk@atlantis...
Most people I'd wager are still used to thumbnails opening up, no?
Really? I see quite a mixture.


That would support my statement.
And if you put them inline with CSS, your "forcing" them to download the
larger picture right? [...]


Huh? Where did that come from? No, you link to the image. The user can
then choose to open the image in a new window, or replace the current
content and later use the Back button.


Opening an image where it takes up only a small portion of a large screen
with a plain background is, in my opinion, an ugly way to do it.
Either way, you're "forcing" the viewer to view the page how you want
them to, the moment you start writing HTML.
What kind of nonsense statement is that? Of course you have to suggest
some form of layout for the document, but as long your decisions are
remotely sensible, a layout isn't even comparible to forcing an obtrusive
new window on the user.


On this we'll have to agree to disagree. I don't believe they're as
obtrusive as you, especially when it's supported by a common enough action.
You seem to be more interested in what *you* want.


You seem intent on getting people to adhere to your philosophy, and
admonishing those who disagree.
Jul 23 '05 #15
On Wed, 03 Nov 2004 03:01:36 GMT, Applebrownbetty
<applebrown@deletethisspace_gamebanshee.com> wrote:
"Michael Winter" <M.******@blueyonder.co.invalid> wrote in message
news:opsguq5acgx13kvk@atlantis...
[ABB]:
Most people I'd wager are still used to thumbnails opening up, no?


Really? I see quite a mixture.


That would support my statement.


If you think so. I don't.

Perhaps we perceive "used to" differently. Experienced, yes. Common, no.

[snip]
[...] especially when it's supported by a common enough action.
That action is becoming more and more unreliable.
You seem to be more interested in what *you* want.


You seem intent on getting people to adhere to your philosophy,


Yes, because the practice of forcing new windows is shown to be
undesirable. Whether a large or small number of users object to them isn't
of much consequence as a good design makes new windows unnecessary in most
cases.
and admonishing those who disagree.


I am always happy to accept differing opinions, but only when a good
argument is made. You haven't made that argument so I'm not about to
agree. If you feel I've been overly aggressive, then please accept my
sincere apologies.

As neither of use are going to change our respective positions, might I
suggest the discussion ends here.

Mike

--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.
Jul 23 '05 #16
Randy Webb wrote:
[snip]


Because every single snippet of DW generated code I have ever read is
utter junk and can be re-written to be more readable, more predictable,
and less error-prone.


But this is not DW generated code, and your assertion "every single
snippet of DW generated code I have ever read is utter junk" sounds
uninformed to me.

Mick
Jul 23 '05 #17
Mick White wrote:
Randy Webb wrote:
[snip]
Because every single snippet of DW generated code I have ever read is
utter junk and can be re-written to be more readable, more
predictable, and less error-prone.


But this is not DW generated code, and your assertion "every single
snippet of DW generated code I have ever read is utter junk" sounds
uninformed to me.


You are more than welcome to post some DW created code here to "inform"
me then. But I will repeat what I said
"Every single snippet of DW generated code I have ever read"
is utter JUNK.

Now, unless they have changed the garbage code it produces in the last 6
months or so, my assertion remains. If its been changed, and DW code is
posted thats actually worth a wooden nickel, I will change my mind.
Until I see different though, it remains JUNK CODE.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq
Jul 23 '05 #18

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Willem van Isselmuden | last post: by
4 posts views Thread by Jamie Jackson | last post: by
5 posts views Thread by Obantec Support | last post: by
3 posts views Thread by Treetop | last post: by
7 posts views Thread by E Michael Brandt | last post: by
1 post views Thread by Chris Leffer | last post: by
7 posts views Thread by anthony.turcotte | last post: by
3 posts views Thread by John Pote | last post: by
reply views Thread by NPC403 | last post: by
reply views Thread by Teichintx | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.