Closed (fixed)
Project:
Lightbox2
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
31 Aug 2008 at 13:34 UTC
Updated:
8 Jan 2009 at 13:40 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
stella commentedCan you provide more information on the setup so I can try to reproduce it on my site? Or could you send me a link to your site? My contact form is enabled if you wish to do so privately.
Cheers,
Stella
Comment #2
wilson98 commentedhere's the detail.
drupal:6.4
modules: CCK-6.x-2.0-rc6, Imagefield-6.x-3.0-alpha, Imagecache-6.x-1.0alpha, Lightbox2-6.x-1.x-dev, Popups-1.1-beta2, and any dependency modules.
1. enable all modules;
2. edit content type 'story', add an image field;
3. add an imagecache preset 'thumb', add an action for example 'scale';
4. back to 'content types'->'edit story'->'display fields', set the image field to be "Lightbox2: thumb->original";
5. add an story node, test whether the lightbox2 works.
6. suggest current theme is garland. open template.php, add this function:
function phptemplate_preprocess_node(&$vars) {
popups_add_popups();
}
7. open node.tpl.php,
replace
if ($page == 0):print $node_url " title="
print $title">print $titleendif;with
if ($page == 0):print $node_url " title="
print $title" class='popups'>print $titleendif;8. clear the cache. back to the home page. click the story title, popup the story node, click the images in the node, popup lightbox2.
Comment #3
ncy commentedjust a shot in the dark, the double close-button reminds me of this:
http://drupal.org/node/295805
and:
http://drupal.org/node/235562
also:
http://drupal.org/node/242086
jQuery conflict?
Comment #4
Anonymous (not verified) commentedI have seen something similar. Multiple close and navigation buttons when using Lightbox on views. Additionally, the "loading" animation remains visible on top of the image.
The problem happens when visiting all but the first page of a view that spans multiple pages (showing a pager at the bottom).
I was able to work around the issue by selecting the "Disable javascript with Views" in the views module.
It must be a conflict where the javascript code of lightbox.js gets executed twice (or more) causing duplicate elements in the DOM tree:
PS: I'm changing the issue title because it does not only occur in combination with popups.
Comment #5
stella commentedI think this is a different issue and is a duplicate of #276985: Constant animation in I.E 7 and broken image and is caused by the nice menus module. If you don't have nice menus installed, then it's probably because jquery.js is being loaded twice on the same page, either by another module or your theme.
Comment #6
Anonymous (not verified) commentedI'm not using the 'nice menus' module. It must be the views module causing the trouble. I hope to have some time tomorrow to dig a little deeper.
Hopefully we can make the javascript robust enough so that other modules/themes can't break it no matter how often jquery.js gets loaded.
Comment #7
stella commentedlitrik: I doubt this is an issue with the views module. Can you provide a link to your site perhaps? Can you double-check your theme to ensure it's not printing $scripts twice? Also if using rel="lightmodal", please ensure that the content you are opening in the lightbox window does not contain html, body or header tags - if they are, please use rel="lightframe" instead.
Cheers,
Stella
Comment #8
Anonymous (not verified) commentedThe actual issue is not probably in the views module. But I'm sure there is something in the views module (and the popups module) that triggers the issue in the Lightbox2 module.
That is not going to help because it's a customer site that wen tlive this weekend. I worked around the issue by disabling javasscript support in the views module (as mentioned in #302262-4)
My theme (a Zen sub theme) is printing $scripts only once and I'm not using rel="lightmodal".
In the meantime I was able to dig a little deeper and I think I have found the real cause:
lightbox.js contains
The initialize() method contains a lot of calls to append() to add the UI to the current DOM.
If I understand the Drupal.behaviors documentation correctly the code will get executed again whenever an AJAX call is executed. Since the lightbox code doesn't do anything with the context parameter the initialize function executes the exact same code even though only a part of the DOM was modified. This results in duplicate elements (close button, navigation buttons, 'loading' animation,...) in the DOM.
When I add a simple alert(context) to the initLightbox() function I see that the first call to initLightbox() passes a HTMLDocument. After clicking on the pager of a AJAX-ified view there is a second call with an HTMLDivElement as parameter.
I'll see if I can come up with a patch that avoids unnecesssary calls to Lightbox.initialize(). (It might be as simple as adding an if surrounding the Lightbox.initialize())
Comment #9
Anonymous (not verified) commentedStella, here is a patch that fixes the duplicate DOM elements when the lightbox2 module is used on pages that use AJAX.
I have moved the call to initList() out of initialize(). Initialize is only called when the full document is loaded. initList() is always called().
This patch fixes my problems in combination with AJAX-ified views. I can't verify whether it fixes the conflict with the popups module.
Comment #10
pwhite commentedJust on a side note I had exactly the same problem and it was caused by including js files in the theme for some other functionality I needed:
Comment #11
stella commentedThis has been fixed in the latest dev release of the module, available later today. Thanks.
Cheers,
Stella
Comment #12
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.
Comment #13
stella commentedReleased in Lightbox2 6.x-1.9.
Cheers,
Stella