js代码
<script src="js/jquery-1.10.1.min.js"></script> <script src="js/idangerous.swiper2.7.6.min.js"></script> <script src="js/swiper.animate1.0.2.min.js"></script> <script> var mySwiper = new Swiper ('.swiper-container', { pagination: '.pagination', paginationClickable :true, autoplay : 10000, speed:1, //autoplayDisableOnInteraction : false, onInit: function(swiper){ //Swiper2.x的初始化是onFirstInit swiperAnimateCache(swiper); //隐藏动画元素 swiperAnimate(swiper); //初始化完成开始动画 }, onSlideChangeEnd: function(swiper){ swiperAnimate(swiper); //每个slide切换结束时也运行当前slide动画 } }) $('.arrow-left').on('click', function(e){ e.preventDefault() mySwiper.swipePrev() }) $('.arrow-right').on('click', function(e){ e.preventDefault() mySwiper.swipeNext() }) </script>