PDA

View Full Version : Lightbox image viewer: Simple Array Help



JackJack
04-28-2008, 08:08 PM
1) Script Title: Lightbox image viewer 2.03a

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

3) Describe problem: I want to use the Previous and Next button to show my images 13 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

JackJack
04-28-2008, 10:04 PM
<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

:)

jscheuer1
04-29-2008, 08:21 AM
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:


<!-- 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 -->

JackJack
04-29-2008, 05:07 PM
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

:)

aerah08
07-01-2011, 06:19 AM
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

jscheuer1
07-01-2011, 07:18 AM
This is an old thread. If you want help, please start a new thread.