View Full Version : How to control the Lightbox image viewer with a select

03-07-2008, 11:51 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 need to control the Lightbox image viewer with a select form or with a javascript function using the onchange event of the select. How to do that?

In the example is used this:

<a href="images/image-1.jpg" rel="lightbox" title="my caption">image #1</a>

But I dont have a link or thumbnail, I have a select like this:

<SELECT name="images" onchange="viewer();">


03-08-2008, 02:53 AM
As far as I know, you would still need links, at least that would be the easiest approach. They could be in a division with the style display:none; though. That way they wouldn't be seen, ex:

<div style="display:none">
<a id="im1" href="images/image-1.jpg" rel="lightbox" title="my caption">image #1</a>
<a id="im2" href="images/image-2.jpg" rel="lightbox" title="my caption">image #2</a>

You can have as many of those as you need for all of your images. Then the select could be run like so:

<option>Select Image</option>
<option value="im1">Image 1</option>
<option value="im2">Image 2</option>