Active
Project:
Ajax
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
20 Oct 2009 at 12:31 UTC
Updated:
31 May 2012 at 00:01 UTC
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
Comment #1
wizonesolutionsI 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(
Drupal.ajax.init();'#value' => '
',
);
Hope this helps (and gets seen by the maintainer...)
Kevin
Comment #2
YK85 commented+1 subscribing
Comment #3
dshumaker commented+1 subscribing. I'll try Kevin's idea in post 1, but it would be great to get this supported for lightbox2.
Comment #4
cluke009 commentedI 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.
Comment #5
nigelcunningham commentedThe 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:
My js then does:
(#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.