Welcome to TalkGraphics.com
Results 1 to 3 of 3

Thread: resized popups

  1. #1

    Default

    Hey all,
    I was wondering how you make so that when you click on a photo it opens in a new window but the new window is the size of the photo.
    I downloaded a script from javafile but it seemed a little excessive, just wondering what you guys have to say.
    this is the script from javafile:
    <SCRIPT LANGUAGE="JavaScript">

    <!-- Begin
    function CaricaFoto(img){
    foto1= new Image();
    foto1.src=(img);
    Controlla(img);
    }
    function Controlla(img){
    if((foto1.width!=0)&&(foto1.height!=0)){
    viewFoto(img);
    }
    else{
    funzione="Controlla('"+img+"')";
    intervallo=setTimeout(funzione,20);
    }
    }
    function viewFoto(img){
    largh=foto1.width+20;
    altez=foto1.height+20;
    stringa="width="+largh+",height="+altez;
    finestra=window.open(img,"",stringa);
    }
    // End -->
    </script>

    cheers
    chuck
    IP

  2. #2

    Default

    Hey all,
    I was wondering how you make so that when you click on a photo it opens in a new window but the new window is the size of the photo.
    I downloaded a script from javafile but it seemed a little excessive, just wondering what you guys have to say.
    this is the script from javafile:
    <SCRIPT LANGUAGE="JavaScript">

    <!-- Begin
    function CaricaFoto(img){
    foto1= new Image();
    foto1.src=(img);
    Controlla(img);
    }
    function Controlla(img){
    if((foto1.width!=0)&&(foto1.height!=0)){
    viewFoto(img);
    }
    else{
    funzione="Controlla('"+img+"')";
    intervallo=setTimeout(funzione,20);
    }
    }
    function viewFoto(img){
    largh=foto1.width+20;
    altez=foto1.height+20;
    stringa="width="+largh+",height="+altez;
    finestra=window.open(img,"",stringa);
    }
    // End -->
    </script>

    cheers
    chuck
    IP

  3. #3
    Join Date
    Aug 2000
    Location
    Las Vegas, NV
    Posts
    819

    Default

    whether you have just one photo you want to open in a new window. If this is the case you could use some simple javascript to open a new window with a given width and height. See this WebMonkey article:

    Tutorial

    This would also work if you have several different photos and they are the same size and you want them to replace one another in the same window.

    However if you have several photos of different size you'll have to use something like what you have above.

    Mickie
    IP

 

 

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •