PDA

View Full Version : call lightbox using javascript



chishikinohito
10-09-2009, 11:49 AM
Speaking about lightbox 2.03.

Do you know how to call lightbox gallery with rel="exmaple1" from javascript?

like onClick="javascript:exmaple1"

Does anyone know? with jQuery would be alright too..


Thank you for any help!

jscheuer1
10-09-2009, 12:02 PM
In future, please post new questions in a new thread like here where I've moved this post, and:

Warning: Please include a link to the DD script in question in your post. See this thread (http://www.dynamicdrive.com/forums/showthread.php?t=6) for the proper posting format when asking a question.

To answer your question though, you can do, say your anchor that you want activated has an id:


<a href="some_big.jpg" id="image_2" rel="lightbox"><img src="some_small.jpg" alt=""></a>

To activate it from javascript:


myLightbox.start(document.getElementById('image_2')).apply(document.getElementById('image_2'));

kevpatts
08-05-2010, 02:40 PM
I get a javascript error when I do this: myLightbox is not defined.

azoomer
08-05-2010, 02:49 PM
We need a link to the page in order to help.

jscheuer1
08-05-2010, 04:06 PM
I get a javascript error when I do this: myLightbox is not defined.

Open a new thread for a new question.