Results 1 to 6 of 6

Thread: Lightbox image viewer: Simple Array Help

  1. #1
    Join Date
    Apr 2008
    Posts
    22
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Smile Lightbox image viewer: Simple Array Help

    1) Script Title: Lightbox image viewer 2.03a

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...box2/index.htm

    3) Describe problem: I want to use the Previous and Next button to show my images 1–3 in the lightbox as described in the DD code below.

    <a href="images/image-1.jpg" rel="lightbox[roadtrip]">image #1</a>
    <a href="images/image-2.jpg" rel="lightbox[roadtrip]">image #2</a>
    <a href="images/image-3.jpg" rel="lightbox[roadtrip]">image #3</a>

    But, I don't want to show image #2 and #3 as links, just image 1.

    example: <a href="images/image-1.jpg" rel="lightbox[roadtrip]">image #1</a>

    How do I keep image #2 and #3 in the lightbox[roadtrip] array so that they will show in the gallery?



    -JackJack

  2. #2
    Join Date
    Apr 2008
    Posts
    22
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default Quick and dirty way.

    <p><a href="01.jpg" rel="lightbox[posters]" title="Poster One">See sample poster set</a>

    <a href="02.jpg" rel="lightbox[posters]" title="Poster Two"></a>
    <a href="03.jpg" rel="lightbox[posters]" title="Poster Three"></a>

    This works, but there must be a cleaner, more efficient way.

    Any ideas?

    -JackJack


  3. #3
    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

    I don't know what's so dirty about it. It certainly is quick. In fact, this is basically the recommended method. If, for organizational purposes, you wanted to have descriptive text in the tags and comments (both of which would only be seen in the source code) so it would be easier to recognize later what you had done (by you or anyone looking at the code), you could do it like so:

    HTML Code:
    <!-- Poster Group -->
    <a href="01.jpg" rel="lightbox[posters]" title="Poster One">See sample poster set</a>
    <div style="display:none;"><!-- Unseen Links in the Poster Group -->
    <a href="02.jpg" rel="lightbox[posters]" title="Poster Two">Anything You Want Here</a>
    <a href="03.jpg" rel="lightbox[posters]" title="Poster Three">More Descriptive Text</a>
    </div><!-- End Poster Group -->
    - John
    ________________________

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

  4. #4
    Join Date
    Apr 2008
    Posts
    22
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default

    Thanks for the reply.

    I thought there might be a way to establish a javascript array in the <head> named "posters" consisting of the jpg images.

    Example:
    <script type="text/javascript">
    var posters = new Array("01.jpg", "02.jpg", "03.jpg");
    </script>


    But it didn't work.

    I like the <div style="display:none;">. I was concerned that the <a> might pick up on a style and give the page a paragraph break.

    - JackJack


  5. #5
    Join Date
    Jul 2011
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    why don't you try this one..

    <script type="text/javascript">
    <!--
    var myArray = new Array();

    myArray[0] = "01.jpg";
    myArray[1] = "02.jpg";
    myArray[2] = "03.jpg";

    document.write(myArray[0] + myArray[1] + myArray[2]);
    //-->
    </script>


    i have the same scenario in one of my projects.. but the only difference is i must do it inside of a php code.. and im not so expert with regards to php arrays.. :'( haaayyy

  6. #6
    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 an old thread. If you want help, please start a new thread.
    - John
    ________________________

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

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
  •