Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save mlbd/838ba56efbf485fe9eb9e2fa1288cb08 to your computer and use it in GitHub Desktop.
Save mlbd/838ba56efbf485fe9eb9e2fa1288cb08 to your computer and use it in GitHub Desktop.
var mySwiper = new Swiper('.swiper-container', {
slidesPerView: 5,
spaceBetween: 30,
loop: true,
centeredSlides: true,
pagination: {
el: '.swiper-pagination',
clickable: true,
},
on: {
slideChange: function () {
var activeIndex = this.activeIndex;
var realIndex = this.slides.eq(activeIndex).attr('data-swiper-slide-index');
$('.swiper-slide').removeClass('swiper-slide-nth-prev-2 swiper-slide-nth-next-2');
$('.swiper-slide[data-swiper-slide-index="'+realIndex+'"]').prev().prev().addClass('swiper-slide-nth-prev-2');
$('.swiper-slide[data-swiper-slide-index="'+realIndex+'"]').next().next().addClass('swiper-slide-nth-next-2');
},
}
});
@alisamie97
Copy link

thanks man

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment