By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,480 Members | 1,766 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,480 IT Pros & Developers. It's quick & easy.

Secondary window won't resize

P: n/a
From one of the online Javascript tutorials, I learned how to
open a new window and set its size. I'm building a page that has
several small photographs, and I want to let the viewer examine
either a full size image or an image with supporting detail.
It's the same idea used on lots of Web sites that show thumbnails
where you click on one and the full-size image is displayed in a
new window. However, I have different-sized images that will appear
in the new window, and I want it to resize automatically to
accommodate each new image. I don't know how to do that. The page
in question is at

http://cpacker.org/misc/petersquare

What happens with this page is that the new window has the
dimensions of the first image first clicked on. Click on another and
the new image appears in the window, but the window retains the dimensions
of the first image.

Also, "resizable=no" didn't work for me -- I could still drag on
the lower right corner of the new window and resize it manually.
I assume that's what the option is supposed to control.

Oddly enough, when I bundled the Javascript statements in a <SCRIPT...</SCRIPT>
bracket above the </HEAD> in the manner of some Web sites, the new window
retained the height of the first image, but was always about 100 pixels wide.

I browsed this newsgroup and there are a lot of threads about this issue.
learned about window.resizeTo, but that didn't work. For example,
I tried
function A1() { window.resizeTo(865,795); window.open('stpeters.jpg'...
but still got the tall skinny window I mentioned above.
Any help would be appreciated.
Jul 20 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
DU
Charles Packer wrote:
From one of the online Javascript tutorials, I learned how to
open a new window and set its size. I'm building a page that has
several small photographs, and I want to let the viewer examine
either a full size image or an image with supporting detail.
It's the same idea used on lots of Web sites that show thumbnails
where you click on one and the full-size image is displayed in a
new window. However, I have different-sized images that will appear
in the new window, and I want it to resize automatically to
accommodate each new image. I don't know how to do that. The page
in question is at

http://cpacker.org/misc/petersquare

What happens with this page is that the new window has the
dimensions of the first image first clicked on. Click on another and
the new image appears in the window, but the window retains the dimensions
of the first image.
So your code needs to store the url of the ith image so that if an jth
image is clicked, then the jth image dimensions will be passed as
parameters in the window.open call.

Also, "resizable=no" didn't work for me -- I could still drag on
the lower right corner of the new window and resize it manually.
Which browser does that? Anyway, for the sake of usability and
accessibility to content, windows should *always* be resizable.
I assume that's what the option is supposed to control.

Oddly enough, when I bundled the Javascript statements in a <SCRIPT...</SCRIPT>
bracket above the </HEAD> in the manner of some Web sites, the new window
retained the height of the first image, but was always about 100 pixels wide.

As soon as there is a parsing problem in the windowFeatures string,
browsers stop processing that string and renders a secondary window with
default values (or persistent data).

window.open('stpeters.jpg', ' ','width-865,height=795,resizable=no'
is in your page's code.
width-865 will cause parsing problem. Browsers will try to see if
"width-865,height" is actually a valid windowFeature.
I browsed this newsgroup and there are a lot of threads about this issue.
learned about window.resizeTo, but that didn't work. For example,
I tried
function A1() { window.resizeTo(865,795); window.open('stpeters.jpg'...
but still got the tall skinny window I mentioned above.
No. You're trying to resize the current window, not the one you want to
create (and which is not created yet). Anyway, many browsers give their
users the veto power to neutralize resizeTo() calls, so this is not
reliable nor recommendable anyway.
Any help would be appreciated.


Have a look at this page which addresses your problem:
http://www10.brinkster.com/doctorunc...Thumbnail.html

Also but more complex
Create a sub-window and dynamically DOM-insert an image
http://www10.brinkster.com/doctorunc...geInPopup.html

DU
Jul 20 '05 #2

P: n/a
DU <dr*******@hotWIPETHISmail.com> wrote in message news:<bs**********@news.eusc.inter.net>...
Have a look at this page which addresses your problem:
http://www10.brinkster.com/doctorunc...Thumbnail.html

Well, that page has a banner that says "This file still under
construction."
However, your followup, while not exactly an answer to three decimal
places, so to speak, did give me the strength to flail onward, and my
latest version of
http://cpacker.org/misc/petersquare
gets me the right-sized secondary image, but only after two clicks.
The extra click simply kills the previous secondary window.
Jul 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.