Hello and welcome to our community! Is this your first visit?
Register
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
    Location
    Austin, Texas
    Posts
    1
    Thanks
    0
    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.

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

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

    http://www.dynamicdrive.com/dynamicindex4/indexb.html

  • #3
    Senior Coder rnd me's Avatar
    Join Date
    Jun 2007
    Location
    Urbana
    Posts
    4,366
    Thanks
    11
    Thanked 590 Times in 571 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 13/9/26)
    BROWSER STATS [% share] (2014/9/03) IE7:0.1, IE8:4.6, IE11:9.1, IE9:3.1, IE10:3.0, FF:17.2, CH:46, SF:11.4, NON-MOUSE:38%


  •  

    Posting Permissions

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