Created
June 14, 2014 01:00
-
-
Save christopherdro/d4189b5f11df53684c1d to your computer and use it in GitHub Desktop.
This file contains hidden or 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 maxSlides = 7; | |
var mySwiper = new Swiper('.swiper-container',{ | |
slidesPerView: maxSlides, | |
slidesPerGroup: maxSlides, | |
watchActiveIndex: false, | |
initialSlide: 7, | |
onSlideClick : function () { | |
console.log(mySwiper.clickedSlideIndex); | |
}, | |
onSlideChangeEnd : function () { | |
if(mySwiper.activeIndex == 0) { | |
mySwiper.prependSlide('<div class="title">test' + counter++ + '</div>'); | |
mySwiper.prependSlide('<div class="title">test' + counter++ + '</div>'); | |
mySwiper.prependSlide('<div class="title">test' + counter++ + '</div>'); | |
mySwiper.prependSlide('<div class="title">test' + counter++ + '</div>'); | |
mySwiper.prependSlide('<div class="title">test' + counter++ + '</div>'); | |
mySwiper.prependSlide('<div class="title">test' + counter++ + '</div>'); | |
mySwiper.prependSlide('<div class="title">test' + counter++ + '</div>'); | |
mySwiper.swipeTo(7,0); | |
} | |
else if (mySwiper.activeIndex == mySwiper.slides.length - maxSlides) { | |
mySwiper.appendSlide('<div class="title">test</div>'); | |
mySwiper.appendSlide('<div class="title">test</div>'); | |
mySwiper.appendSlide('<div class="title">test</div>'); | |
mySwiper.appendSlide('<div class="title">test</div>'); | |
mySwiper.appendSlide('<div class="title">test</div>'); | |
mySwiper.appendSlide('<div class="title">test</div>'); | |
mySwiper.appendSlide('<div class="title">test</div>'); | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment