43
rated 0 times
[
50]
[
7]
/ answers: 1 / hits: 37872
/ 8 Years ago, mon, may 23, 2016, 12:00:00
I have a problem with my owl-carousel. Everything works fine but the active item is the first one on the page not the middle one (the colored is the active one). You can see this in the following screenshot.
I would like to have the middle item always be the active item.
My JQuery code :
jQuery(.owl-carousel).owlCarousel({
items:3,
loop:true,
nav:true,
responsive:{
0:{
items:1,
stagePadding: 450
},
600:{
items:1,
stagePadding: 450
},
1000:{
items:1,
stagePadding: 450
}
}
});
I found something like this but it doesn work:
jQuery(.owl-carousel).owlCarousel({
items:3,
loop:true,
nav:true,
// THIS IS THE NEW PART
afterAction: function(el){
//remove class active
this
.$owlItems
.removeClass('active')
//add class active
this
.$owlItems //owl internal $ object containing items
.eq(this.currentItem + 1)
.addClass('active')
}
// END NEW PART
responsive:{
0:{
items:1,
stagePadding: 450
},
600:{
items:1,
stagePadding: 450
},
1000:{
items:1,
stagePadding: 450
}
}
});
More From » jquery