Event handler duplicating object
I am fairly new to jQuery, and I've added an event handler to launch a slideshow from the "a" tag around an image. The problem arises when I try to ad a plain hyperlink to the caption for the image, that has another handler to open the same slideshow. Now when I use either the image or the hyperlink to open the slideshow, the number of slides is doubled, because it is creating another instance of the object colorbox()
How can I handle this? I thought since I was refrencing the same "a.slideGroup" it would be fine. Here are my handlers:
- $('.slide').on('click', 'a.isSlideshow', function() {
- $('a.slideGroup').colorbox({rel:'slideGroup1', open:true});
- });
-
-
- $('.imageCaption').on('click', 'a#openGallery', function() {
- $('a.slideGroup').colorbox({open:true});
- });