1

I want to add some of my own jQuery to objects that reside in the image "caption" area on the Galleriffic gallery plugin (http://www.twospy.com/galleriffic/).

However, none of the jQuery that I place into the caption area will execute. It's as if all events get dropped.

I thought it was because Galleriffic uses remove() instead of detach(), so I changed everything to detach() but that didn't help. I still appears that all events are removed from everything in the "caption" area.

Is there anyone out there that has figured out how to add your own custom jQuery into this caption area and have it retained? Or have any other pointers as to why all my events in this area would get removed now that I'm using detach()?

I'm open to any creative ideas here!

DigCamara
  • 5,540
  • 4
  • 36
  • 47

1 Answers1

0

You need to register the event handlers with the caption element using event delegation mechanism.

Ex:

$('#caption').on('click', 'a', function(){
    console.log($(this).attr('href'))
});

Demo: Fiddle

Arun P Johny
  • 384,651
  • 66
  • 527
  • 531