Question

Using great jcarousel connected carousels plugin, so to execute it using this file https://github.com/jsor/jcarousel/blob/master/examples/connected-carousels/jcarousel.connected-carousels.js, as you see

$(function() {
        // Setup the carousels. Adjust the options for both carousels here.
        var carouselStage      = $('.carousel-stage').jcarousel();
        var carouselNavigation = $('.carousel-navigation').jcarousel();

initializes jcarousel(), it's working great, but i'm inserting new images on carousel-stage and carousel-navigation on the fly, and on new images the effects are not being applied, how to reinitialize this function on file?

Was it helpful?

Solution

When you append your new pictures, just call the "destroy" method ( http://sorgalla.com/jcarousel/docs/reference/api.html#destroy ) and restart the pluggin calling

var carouselStage      = $('.carousel-stage').jcarousel();
var carouselNavigation = $('.carousel-navigation').jcarousel();

back again. SO:

// Destroy
// Add images
// Rebuild
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top