OwlCarousel2 / OwlCarousel2

DEPRECATED jQuery Responsive Carousel.

Home Page:http://owlcarousel2.github.io/OwlCarousel2/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Event Initialize and Initialized can't work after get data from API, another events are working

syihabuddin2 opened this issue · comments

Event Initialize and Initialized can't work after get data from API, another events are working.
please help to resolve.
thank you.

example my issue:
$.ajax({
url: APIUrl,
type: 'GET',
dataType: "json",
headers: headers,
success: function(res){
winnerData(res);
},
error: function(errorMessage, textStatus, errorThrown) {
},
});

function winnerData(value){
$('.owl-carousel.list-winner').on('initialize.owl.carousel initialized.owl.carousel', function(e){
let index = e.item.index;
console.log(e); /* can't showing the log, if using another events can be showing */
$('.owl-item').eq(index).addClass('secondPeriod');
$('.owl-item').eq(index+1).addClass('secondPeriod');
});
}