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

snufkin’s picture

Version: master » 6.x-1.x-dev
StatusFileSize
new2.82 KB

Rerolled 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.

snufkin’s picture

Status: Active » Reviewed & tested by the community

forgot to change to rtbc

stella’s picture

Status: Reviewed & tested by the community » Fixed

Committed, 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

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.

stella’s picture

Released in Lightbox2 6.x-1.9.

Cheers,
Stella