質問

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