Secondary window won't resize

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Charles Packer

    Secondary window won't resize

    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



    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('st peters.jpg'...
    but still got the tall skinny window I mentioned above.
    Any help would be appreciated.
  • DU

    #2
    Re: Secondary window won't resize

    Charles Packer wrote:
    [color=blue]
    > 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.[/color]

    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.
    [color=blue]
    >
    > 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.[/color]

    Which browser does that? Anyway, for the sake of usability and
    accessibility to content, windows should *always* be resizable.
    [color=blue]
    > 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.
    >[/color]

    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('st peters.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.
    [color=blue]
    > 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('st peters.jpg'...
    > but still got the tall skinny window I mentioned above.[/color]

    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.
    [color=blue]
    > Any help would be appreciated.[/color]

    Have a look at this page which addresses your problem:


    Also but more complex
    Create a sub-window and dynamically DOM-insert an image


    DU

    Comment

    • Charles Packer

      #3
      Re: Secondary window won't resize

      DU <drunclear@hotW IPETHISmail.com > wrote in message news:<bshvmb$p2 9$1@news.eusc.i nter.net>...[color=blue]
      > Have a look at this page which addresses your problem:
      > http://www10.brinkster.com/doctorunc...Thumbnail.html
      >[/color]


      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

      gets me the right-sized secondary image, but only after two clicks.
      The extra click simply kills the previous secondary window.

      Comment

      Working...