Created
July 21, 2018 08:36
-
-
Save mlbd/838ba56efbf485fe9eb9e2fa1288cb08 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'); | |
}, | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
thanks man