更新时间:2020-07-15 10:26:42
swiper引入:
<link rel="stylesheet" href="css/swiper.min.css"> <script src="js/swiper.min.js"></script>
swiper调用(例1为例):
var swiper = new Swiper('#newsList1', { effect : 'fade', fadeEffect: { crossFade: true, }, direction : 'horizontal', loop: true, autoplay : { delay:5000,//滚动速度 disableOnInteraction: false, }, pagination: { el: '.adSN_page', clickable :true, }, on:{ init:function(){ var total=this.slides.length-2; $('.swiper-num .total').text('0'+total); this.emit('transitionEnd'); }, transitionEnd:function(){ var index=this.realIndex+1; $(".swiper-num .active").text("0"+index); } } });