hi guys
I have been trying for sometime now to call lightbox from a function. I suppose the question is can I structure a function so to call lightbox and load a given image?
any clues or ideas really appreciate.
many thanks
regards
giacbus
hi guys
I have been trying for sometime now to call lightbox from a function. I suppose the question is can I structure a function so to call lightbox and load a given image?
any clues or ideas really appreciate.
many thanks
regards
giacbus
This depends so much upon the version of Lightbox that you are using. I believe it can be done in all versions, but the syntax is different, and some versions would require at least slight modification first.
If you are using this version (2.03a):
http://www.dynamicdrive.com/dynamici...box2/index.htm
It is easiest if you have an anchor link, but you can create one and you don't even need to append it to the document, or you could use an existing (visible or invisible) anchor link.
Let's say an invisible existing anchor link with a unique id:
Once you have that and the page has loaded using the version of Lightbox that I've linked to, you may do in javascript:HTML Code:<a id="u1" href="some_image.jpg" style="display: none;" rel="lightbox" title="This is my caption"></a>
Code:myLightbox.start(document.getElementById('u1'));
- John________________________
Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate
This doesn't work for me.
I get a javascript error: myLightbox is not defined.
open a new thread for a new question.
- John________________________
Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate
Bookmarks