Add custom html to lightbox2

I have a gallery made using lightbox 2, made in normal mode with sketches, etc. Now I need to add HTML via JS to the lightbox div 2. How do I do this?

At first I thought, just make a function and name it using onclick, but the lightbox is not ready then, so I have to wait until it is ready, how can I do it? Lightbox uses a prototype structure. Is this possible, something like a listener?

Thanks:)

+4
source share
1 answer

There is no public event in Lightbox2 for this. It’s best to use a script that has public events that you can subscribe to. I would recommend Fancybox or Colorbox .

With Fancybox, you just need to add the code inside the onComplete function, which is called when Fancybox completes.

Note that both of them use jQuery, but this should not be a problem if you use noConflict () .

+4
source

All Articles