Domanda

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?

È stato utile?

Soluzione

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
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top