Reputation: 12047
I'm using the jQuery ColorBox plugin, but it is not working with my AJAX content, and I don't know how to solve this.
I display a post, with the image gallery at the bottom of the post. Users can scroll throught these posts, with AJAX being used to refresh them.
On the initial post, the plugin works great, but on any AJAX generated post with a gallery, the plugin does not fire.
Code that I am using to invoke the plugin -
jQuery(document).ready(function(){
jQuery(".lightbox").colorbox({
rel: 'lightbox',
height: '90%',
slideshow: true,
slideshowStart: 'Start Slideshow - ',
slideshowStop: 'Pause Slideshow - '
});
});
Link to the ColorBox plugin page - http://www.jacklmoore.com/colorbox
Upvotes: 0
Views: 848
Reputation: 9538
but on any AJAX generated post with a gallery, the plugin does not fire.
After you make your ajax call, you need to assign colorbox again so that it can be applied to the new elements. Your ajax call will provide a callback for doing exactly this sort of thing.
Upvotes: 1