Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
I have an event handler like so:
$(document).bind('cbox_closed', function(){
console.log( 'bind' );
});
I know the bind is not set twice, its the closed that is called twice.
Every time I close the colorbox I get this console log twice, and therefore any code within the bind gets implemented twice.
Is this expected or do I have a weird issue somewhere?
Comments
Comment #1
arosboro CreditAttribution: arosboro commentedI think this issue should be made in colorbox's github issue queue. I'm seeing 6 calls with colorbox_node, so I don't think this is specific to drupal, although it may be.
Comment #2
arosboro CreditAttribution: arosboro commentedFurther investigation shows that this is caused by the behavior being attached multiple times.
I refactored my javascript to work like this:
Comment #3
Neslee Canil Pinto