Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Sep 2008
    Austin, Texas
    Thanked 0 Times in 0 Posts

    Angry How do you write a javascript to open images?

    I have seen this feature on many websites.
    There is a list of 10 photo thumnails on display, example
    <img src="pix1tn.jpg"><img src="pix2tn.jpg">..<img src="pix10tn.jpg">

    When you move the mouse to a thumnail, say pix2tn, and click on it, it opens a small window showing photo (pix2.jpg) using javascript instead of a new html page. The new picture window displays the larger photo and has 3 buttons, one to close the window, one to close this pix and show the previous pix (pix1.jpg), and one to close this pix and show the next pix (pix3.jpg).

    I thought this was a simple task, but when I looked at its javascript and tried to make changes to it, it didn't work.
    I need some help on this javascript for my personal website. If it's not against any codingforums' rules, I would offer $25 paypal money for the first person that posts the working javascript.

    The code on the html shows something like <div class="movie-stills-thumbnail"><a href="javascriptpen_picture_viewer(2)"><img id="movie-stills-thumbnail-2" src="pix2tn.jpg" width="63" height="35"></a></div>

    The (2) in this case indicates the pix to be displayed will be pix2.jpg.

    Last edited by wu1821; 09-29-2008 at 01:42 AM.

  • #2
    Regular Coder
    Join Date
    Mar 2008
    Thanked 9 Times in 9 Posts
    You're looking for a lightbox script. You can find a few on Dynamic Drive.


  • #3
    Senior Coder rnd me's Avatar
    Join Date
    Jun 2007
    Thanked 602 Times in 582 Posts
    if you changed open_picture_viewer, you could avoid having to pass any arguments.
    this would let you cut and paste the same thing in each tag, saving a bit of time.
    my site (updated 2014/10/20)
    BROWSER STATS [% share] (2014/9/03) IE7:0.1, IE8:4.3, IE11:9.2, IE9:2.7, IE10:2.6, FF:16.8, CH:47.5, SF:7.8, NON-MOUSE:37%


    Posting Permissions

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