constructor(element) {
this.$element = $(element);
this.$slider = this.$element.find('.team-carousel__slider');
this.init();
}
init() {
const itemCount = this.$slider.find('.team-carousel__slider-item').length;
if (itemCount > 4) {
this.$slider.addClass('owl-carousel');
this.$slider.owlCarousel({
margin: 30,
center: false,
autoplay: true,
autoplaySpeed: 2000,
autoplayHoverPause: true,
responsiveClass: true,
items: 1,
navText: [
'<a class="arrow-left" aria-hidden="true"></a>',
'<a class="arrow-right" aria-hidden="true"></a>',
],
responsive: {
576: {
items: 1,
},
789: {
items: 2,
},
992: {
items: 3,
},
1199: {
items: 4,
},
},
});
} else if (itemCount <= 4) {
this.$slider.removeClass('owl-carousel');
} else {
this.$slider.removeClass('owl-carousel');
}
}
//$(document).ready(function () {
// var $landingMasthead = $('[data-landing-masthead]');
// if ($landingMasthead.children().length > 1) {
// $landingMasthead.owlCarousel({
// loop: false,
// nav: true,
// dots: true,
// animateIn: true,
// responsiveClass: true,
// items: 1,
// navText: [
// '<a class="arrow-left" aria-hidden="true"></a>',
// '<a class="arrow-right" aria-hidden="true"></a>',
// ],
// });
// } else {
// $landingMasthead.removeClass('owl-carousel');
// }
// });
Comments