Hello,

I really like this module. It does a great job! :)
Is it possible to add support for the Lightbox2 module - the same way as already for the Thickbox?

Regards,
Stefan

Comments

wizonesolutions’s picture

I got this working, but it's a little tricky, for my custom form at least.

First you have to copy the Thickbox plugin's code. Replace "thickbox" with "lightbox2" inside the 3 files. Change the ID from TB_window to lightbox.

Then, if it's a custom form you're doing this for, add this bit of code in your form function...you could probably add it in another way that's a bit nicer than what I did, but this worked for me.

$form['load_ajax'] = array(
'#value' => '

Drupal.ajax.init();

',
);

Hope this helps (and gets seen by the maintainer...)

Kevin

YK85’s picture

+1 subscribing

dshumaker’s picture

Issue tags: +lightbox2 ajax

+1 subscribing. I'll try Kevin's idea in post 1, but it would be great to get this supported for lightbox2.

cluke009’s picture

I tried doing this with both the 6.11 and 6.1.x-dev releases and it didn't seem to to work. The ajax module is never invoked when the form loads. I might try to debug this some more but no guarantees. If someone has a working patch I would be happy to commit it.

nigelcunningham’s picture

The problem seems to me to be with Lightbox2. It doesn't provide a way to invoke code after the loading of the new content is complete. In my case, I got things to work by modifying line 648 of lightbox.js (in the Lightbox module) to explicitly call the JS function I've defined after the show() method is invoked:

            $("#modalContainer").hide().load(src, function () {$('#modalContainer').css({'zIndex': '10500'}).show(); setup_enquiry_form(); });

My js then does:

function setup_enquiry_form() {
        Drupal.attachBehaviors($('#modalContainer'));

        /* ... and more stuff */
}

(#lightbox instead of #modalContainer might be a more generic solution to the problem).

It seems to me that Lightbox2 needs to define and invoke a generic hook for once new content is loaded, but I'm no Lightbox / Javascript guru, so I could be completely wrong.

Hope this helps someone.