Reputation: 185
I am using a slick slider with center mode, I want to add more slides on click of "add" button. My concern is how can I add this new div to 'center' (element which is on focus in center mode) instead of the last item.
$('.add').on('click', function() {
$('.slider').slick('slickAdd','<div>test</div>');
});
Now its adding new element to the last position. (I want this item as the centered item every time when I add new item)
Thanks.
Upvotes: 0
Views: 5628
Reputation: 153
I verified the below code and it works fine hope it works you as well
$('.slider').slick('slickAdd','<div>test</div>', $('.slider').slick('slickCurrentSlide')-1);
Upvotes: 3