Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Just ran into a problem where captions are being reapplied multiple times when using colorbox. I created a 60 second screen cast demoing the problem.
http://www.screencast-o-matic.com/watch/cXfOFYDLC
One solution could be to add a check to the JS to see if the captioning is already set, if so then don't reapply it.
Comments
Comment #1
davidwhthomas CreditAttribution: davidwhthomas commentedThanks for the bug report. I've seen similar issues before on other modules.
It occurs because the drupal.behavior function is run after each js-triggered DOM change.
This is good, if for example the image is added via javascript/ajax and you want it captioned, but not so good in this case where the caption in duplicated.
I'll add a 'caption-processed' class to images already captioned, and check that in the js, which will prevent this occurring.
Comment #2
bryancasler CreditAttribution: bryancasler commentedCouldn't you save the extra class and just check for "image-caption-container". Not that it matters, but I was just wondering if there is another reason to do the previous vs the latter.
Comment #3
davidwhthomas CreditAttribution: davidwhthomas commentedSomething to that effect would also suffice however the Drupal convention seems to be to use a foo-processed class for such instances.
Comment #4
bryancasler CreditAttribution: bryancasler commentedthanks for letting me pick your brain
Comment #5
davidwhthomas CreditAttribution: davidwhthomas commented@animelion, I've added the caption-processed support to a new beta3 release, please update, test and confirm working for you too, thanks.
Comment #6
bryancasler CreditAttribution: bryancasler commentedWorks like a charm.
Comment #7
rooby CreditAttribution: rooby commentedSeems fixed to me.
Comment #10
balazsgabi CreditAttribution: balazsgabi commentedI have downloaded the latest stable version (7.x-2.8) and I found that also. After closing overlay and the page of refresh disappear the multiplicates.
update: sorry this irrelevant here, I am confusioned in my browser tabs. Consider to be superfluous.