Pop up issue

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Kathleen Coyne

    #1

    Pop up issue

    I am trying to find a script for a pop up that will pop up a new
    window with a larger image with these requirements:

    -if javascript is disabled, it must pop up a plain browser with the
    image instead.

    -close when clicked.

    -close when another pop up is created.

    -resize the pop up and image depending on screen resolution.

    any ideas?

    Thanks.
  • Lasse Reichstein Nielsen

    #2
    Re: Pop up issue

    kathleencoyne78 1@aol.com (Kathleen Coyne) writes:
    [color=blue]
    > I am trying to find a script for a pop up that will pop up a new
    > window with a larger image with these requirements:
    >
    > -if javascript is disabled, it must pop up a plain browser with the
    > image instead.[/color]

    Make it a link with a target:

    <a href="imageWrap per.html" target="MyImage Display"

    Then add an onclick handler for when Javascript is enabled:

    onclick="myWinO pen(this)"> CLICK MED </a>

    The myWindOpen function could be:

    var myWinReference;
    function myWinOpen(link) {
    if (myWinReference ) { myWinReference. close(); }
    var imgSize = "medium";
    var popupSize = "width=600,heig ht=480";
    if (screen.availHe ight < 600) {
    imgSize = "small";
    popupSize = "width=400,heig ht=300";
    } else if (screen.availHe ight > 1024) {
    imgSize = "large";
    popupSize = "width=800,heig ht=600";
    }
    myWinReference = window.open("im age-"+imgSize+".htm l",link.targ et,
    popupSize+"resi zable=yes");

    }
    [color=blue]
    > -close when clicked.[/color]

    The page that is loaded is an html file. It has an event handler:
    <body onclick="window .close()">
    [color=blue]
    > -close when another pop up is created.[/color]

    Handled above.
    [color=blue]
    > -resize the pop up and image depending on screen resolution.[/color]

    Handled above, but you obviously will have to pick your own
    delimiters.

    /L
    --
    Lasse Reichstein Nielsen - lrn@hotpop.com
    Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit. html>
    'Faith without judgement merely degrades the spirit divine.'

    Comment

    • DU

      #3
      Re: Pop up issue

      Lasse Reichstein Nielsen wrote:
      [color=blue]
      > kathleencoyne78 1@aol.com (Kathleen Coyne) writes:
      >
      >[color=green]
      >>I am trying to find a script for a pop up that will pop up a new
      >>window with a larger image with these requirements:
      >>
      >>-if javascript is disabled, it must pop up a plain browser with the
      >>image instead.[/color]
      >
      >
      > Make it a link with a target:
      >
      > <a href="imageWrap per.html" target="MyImage Display"
      >
      > Then add an onclick handler for when Javascript is enabled:
      >
      > onclick="myWinO pen(this)"> CLICK MED </a>[/color]

      You need to cancel the default action in the onclick event attribute if
      js support is enabled. Otherwise, the link will be loaded in both windows.
      [color=blue]
      >
      > The myWindOpen function could be:
      >
      > var myWinReference;
      > function myWinOpen(link) {
      > if (myWinReference ) { myWinReference. close(); }[/color]

      This is not precise. The window could be closed and the pointer in
      memory would still exist (e.g.: after viewing the 2nd enlarged image).
      In such case, myWinReference. close(); would do nothing or create an error.

      Also, trying to close the window as the first instruction does not make
      a lot of sense. If the popup is just behind the opener (and this sort of
      circumstances happens often to users) and if the link.href is the same,
      then clicking again on the opener link will close and then recreate the
      same popup: not an efficient way to manage user resources.
      [color=blue]
      > var imgSize = "medium";
      > var popupSize = "width=600,heig ht=480";
      > if (screen.availHe ight < 600) {
      > imgSize = "small";
      > popupSize = "width=400,heig ht=300";
      > } else if (screen.availHe ight > 1024) {
      > imgSize = "large";
      > popupSize = "width=800,heig ht=600";
      > }
      > myWinReference = window.open("im age-"+imgSize+".htm l",link.targ et,
      > popupSize+"resi zable=yes");
      >[/color]

      The OP somewhat wants to create a functionality which is already
      available and implemented in the UI, at the user's discretion in MSIE 6
      and Mozilla browsers.
      [color=blue]
      > }
      >
      >[color=green]
      >>-close when clicked.[/color]
      >
      >
      > The page that is loaded is an html file. It has an event handler:
      > <body onclick="window .close()">
      >[color=green]
      >>-close when another pop up is created.[/color]
      >
      >
      > Handled above.
      >[/color]

      Closing a window by clicking in its content, on an image is not
      intuitive, within normal, expectable user habits. I can understand a
      large button (a real button, not a link) located at the bottom of a
      document, closing a document in a window that needs to be scrolled
      down... but clicking on an enlarged image to closed a window is def. not
      consistent with user habits. Not recommendable IMO.
      [color=blue]
      >[color=green]
      >>-resize the pop up and image depending on screen resolution.[/color]
      >
      >
      > Handled above, but you obviously will have to pick your own
      > delimiters.
      >
      > /L[/color]

      Btw, the poster also multi-posted in alt.html newsgroup.

      DU
      --
      Javascript and Browser bugs:

      - Resources, help and tips for Netscape 7.x users and Composer
      - Interactive demos on Popup windows, music (audio/midi) in Netscape 7.x


      Comment

      • Kathleen Coyne

        #4
        Re: Pop up issue

        DU <drunclear@ho t-R-E-M-O-V-E-mail.com> wrote in message news:<bkacn1$6v $1@news.eusc.in ter.net>...
        <snip>[color=blue]
        > Btw, the poster also multi-posted in alt.html newsgroup.
        >[/color]

        Yup. I did.

        I posted there first. And then I realized that the chances of me
        receiving any sort of valueable information would probably be almost
        impossible.

        I was right. It produced a little war about whether or not I should
        have pop ups at all.

        Then it dawned on me that those who wouldn't get into a tissy about
        pop ups or using javascript would probably be those who are in a
        javascript newsgroup :)

        Thank you very much for your help.

        I modified the javascript I got from:
        http://www.stilleye.com/projects/dhtml/iPop/

        I made it so the pop up would be a little smaller than the user's
        available screen width and height, and then I made the image be as
        wide or as tall as the pop up window. I then have to use two scripts,
        one for tall images, and one for wide images.

        hows that?

        I actually don't know javascript at all <cower> pretty much all I do
        is read what it's doing, try to understand what it's saying, and then
        modify it to my needs. I haven't gotten to the point where I could
        write it on my own, though.

        Comment

        • rf

          #5
          Re: Pop up issue


          "Kathleen Coyne" <kathleencoyne7 81@aol.com> wrote in message
          news:a5423969.0 309190759.789ef 41f@posting.goo gle.com...[color=blue]
          > DU <drunclear@ho t-R-E-M-O-V-E-mail.com> wrote in message[/color]
          news:<bkacn1$6v $1@news.eusc.in ter.net>...[color=blue]
          >
          > Then it dawned on me that those who wouldn't get into a tissy about
          > pop ups or using javascript would probably be those who are in a
          > javascript newsgroup :)
          >
          > Thank you very much for your help.
          >
          > I modified the javascript I got from:
          > http://www.stilleye.com/projects/dhtml/iPop/
          >
          > I made it so the pop up would be a little smaller than the user's
          > available screen width and height, and then I made the image be as
          > wide or as tall as the pop up window. I then have to use two scripts,
          > one for tall images, and one for wide images.
          >
          > hows that?[/color]

          That is incredibly bad. My browser window is currently about 700 wide by 800
          high. A "little smaller than my available screen width and height" is going
          to be a little smaller than 1600 by 1200. You have just covered up all of
          the other windows on my screen!

          Bloody arrogant if you ask me. What is wrong with letting me open the image
          in my existing browser window?

          Cheers
          Richard.


          Comment

          Working...