As from http://drupal.org/node/114774#javascript-behaviors the code should add a class in the form "behaviorName-processed" to ensure the behavior is attached only once to a given element.
The code of initList function (line 176) should be changed to reflect this:
$("a[@rel^='lightbox'], area[@rel^='lightbox']").click(function(e)
$("a[@rel^='lightbox']:not(.lightbox-processed), area[@rel^='lightbox']"):not(.lightbox-processed).addClass('lightbox-processed').click(function(e)
(replicated for other selectors)
Patch attached (Drupal 6.5 - Lightbox2 6.x-1.8).
ema
P.S.
I had a problem with Lightbox on A tag from an AJAX/AHAH form and I was thinking the problem come from a double/multiple initialization on the js solved adding this processed class. Unfortunately the problem it's still there (maybe I'll submit another issue) but the patch is ready.
Comments
Comment #1
snufkin commentedRerolled patch against 6.x-1.x-dev. Original patch failed, so i just applied the changes by hand and did a cvs -up from modules/lightbox2.
- lightbox-processed class is added correctly, when js is disabled it doesnt add it (which is how it meant to work as i understood).
- lightbox functionality continues to work, tested for login form and images.
Comment #2
snufkin commentedforgot to change to rtbc
Comment #3
stella commentedCommitted, thanks! I also extended it so it adds lightbox-processed class to the body tag, which should overcome the duplicate navigation buttons appearing when jquery.js is loaded on a page more than once, (e.g. like with old version of nice menus module).
Cheers,
Stella
Comment #4
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.
Comment #5
stella commentedReleased in Lightbox2 6.x-1.9.
Cheers,
Stella