OwlCarousel2 - Add item + Update carousel

I had difficulty adding Owl Carousel to our application, and I was hoping the latest version 2.0.0-beta.2.4 would be easier, but I can't just get the basic function of adding an item and updating the carousel to work.

Am I doing something wrong here?

Here is the code I'm using:

$('#insert').on('click', function () {
    owl.trigger('add.owl.carousel', '<div class=\"item\"><p>D</p></div>').trigger('update.owl.carousel');
});

Along with the demo:

http://jsfiddle.net/52r9B/11/

The documentation ( http://www.owlcarousel.owlgraphic.com/docs/started-welcome.html ) does not seem to contain anything - unless I miss something obvious.

Any help would be appreciated.

+4
source share
2 answers

OwlCarousel 2.0 . , , (2.0.0-beta.2.4), .

build . , , , -!

+7

, , :

// appends an item to the end
$('.owl-carousel').owlCarousel('add', '<div>foo</div>').owlCarousel('update');
// adds an item before the first item
$('.owl-carousel').trigger('add.owl.carousel', [$('<div>bar</div>'), 0]).trigger('refresh.owl.carousel');

.

!

-1

All Articles