View Full Version : call lightbox with JavaScript event handlers

01-30-2012, 04:26 PM
I want to call Lightbox with a JavaScript OnClick event. Could you tell me how this is done? I have tried this:

but can't make it work.
Thank you:)
To see the page I'm using this on follow this link:
http://fastngoodwebsites.com/victorian 3/lightbox_test.html
I am trying to make a whole table row clickable to present Lightbox photos.

01-30-2012, 05:55 PM
That version of Lightbox has no myLightbox. Even if it did, there are no rel="lightbox" links on that page that you could be trying to invoke that way. And you are using jQuery on that page for the slideshow.

So I'd suggest switching to Slimbox2 (also jQuery based) for the lightbox duties:


Once installed, you can launch a Slimbox lightbox from javascript as described here:


Slimbox will also launch ordinary rel="lightbox" links in the normal manner.

You only need one copy of jQuery for the page, but I'd suggest updating to version 1.6.4 which can be done simply by changing the numbers in the tag as shown:

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>

01-30-2012, 09:40 PM
Thanks! It works like a charm and is valid XHTML. After putting a css {cursor: pointer;} in the class, the entire table row works like a link that opens a lightbox.:)