Results 1 to 4 of 4

Thread: Picture in new popup window

  1. #1
    Join Date
    Nov 2005
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Picture in new popup window

    How can I handle, if i got an image on my site, i click on it and the big picture will open in a new popup window (Not bigger as the picture) that there is no white border. Just the fullsize Picture in this popup...

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    This is actually a bit more complicated than it might appear and you may want further refinements once you get what you are asking for and see how it looks/works. Here is a basic interpretation of what you are asking for -

    In the head of the page, put this script:

    Code:
    <script type="text/javascript">
    function openWin(image, w, h){
    var wh='width='+w+',height='+h
    var tmpPage=window.open('','',wh)
    tmpPage.document.write('<body style="margin:0;padding:0;"><img src="'+image+'" width="'+w+'" height="'+h+'">')
    tmpPage.document.close()
    }
    </script>
    Where you want to click on an image and have the big picture pop up, use this kind of markup in the body of the page:

    Code:
    <a href="photo1.jpg" target="_blank" onclick="openWin(this.href, 140, 225);return false;"><img src="thumb1.jpg" width="50 height="50" border="0"></a>
    photo1.jpg is the name (include the path if different than the page this is on) of the big picture. The two red numbers are the width and height (in that order) of the big picture. The img tag is just an ordinary image tag for the thumbnail (smaller image on the page that you click to get the pop up). You can use this type of markup as many times on the page as you want.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Nov 2005
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thank you I will try it!!!!

  4. #4
    Join Date
    Nov 2005
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    I tried the code, thank you it works!!!

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
  •