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?

有帮助吗?

解决方案

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
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top