jQuery响应式轮播图片 自适应幻灯片
XML/HTML Code
- <div class="swiper-container">
- <a class="arrow-left" href="#"></a>
- <a class="arrow-right" href="#"></a>
- <div class="swiper-wrapper">
- <div class="swiper-slide slide1">
- <a href="" class="inner">
- <img src="http://www.freejs.net/images/logo.png" class="ani img s0" swiper-animate-effect="zoomInDown" swiper-animate-duration="1.5s" swiper-animate-delay="0s">
- <img src="images/s1.png" class="ani img s1" swiper-animate-effect="bounceInLeft" swiper-animate-duration="1s" swiper-animate-delay="0s">
- <img src="images/s2.png" class="ani img s2" swiper-animate-effect="flipInY" swiper-animate-duration="1s" swiper-animate-delay="0.8s">
- <img src="images/s3.png" class="ani img s3" swiper-animate-effect="fadeInUp" swiper-animate-duration="2s" swiper-animate-delay=".2s">
- <img src="images/s4.png" class="ani img s4" swiper-animate-effect="fadeInUp" swiper-animate-duration="2.5s" swiper-animate-delay="0s">
- </a>
- </div>
- <div class="swiper-slide slide2">
- <a href="" class="inner">
- <img src="images/pigBanner_03.png" class="ani img zh-a-1" swiper-animate-effect="bounceInDown" swiper-animate-duration="2s" swiper-animate-delay="0.5s">
- <img src="images/pigBnnaer_1_03.png" class="ani img zh-a-2" swiper-animate-effect="zoomIn" swiper-animate-duration="2s" swiper-animate-delay="0s">
- </a>
- </div>
- <div class="swiper-slide slide3">
- <div class="inner">
- <img src="images/b-1.png" class="ani img b-1" swiper-animate-effect="bounceInLeft" swiper-animate-duration="1.5s" swiper-animate-delay="0s">
- <img src="images/b-2.png" class="ani img b-2" swiper-animate-effect="bounceInRight" swiper-animate-duration="1.5s" swiper-animate-delay="0s">
- <img src="images/b-3.png" class="ani img b-3" swiper-animate-effect="fadeInDown" swiper-animate-duration="1.5s" swiper-animate-delay="0s">
- <img src="images/b-s.png" class="ani img b-s-1" swiper-animate-effect="zoomInDown" swiper-animate-duration="1.2s" swiper-animate-delay="0s">
- <img src="images/b-s.png" class="ani img b-s-2" swiper-animate-effect="zoomInDown" swiper-animate-duration="1.2s" swiper-animate-delay="0s">
- <img src="images/b-s.png" class="ani img b-s-3" swiper-animate-effect="zoomInDown" swiper-animate-duration="1.2s" swiper-animate-delay="0.6s">
- <img src="images/b-s.png" class="ani img b-s-4" swiper-animate-effect="zoomInDown" swiper-animate-duration="1.2s" swiper-animate-delay="0.8s">
- <img src="images/b-s.png" class="ani img b-s-5" swiper-animate-effect="zoomInDown" swiper-animate-duration="1.2s" swiper-animate-delay="1.5s">
- <img src="images/b-s.png" class="ani img b-s-6" swiper-animate-effect="zoomInDown" swiper-animate-duration="1.2s" swiper-animate-delay=".5s">
- <img src="images/b-y-1.png" class="ani img b-y-1 loop" swiper-animate-effect="moveRight" swiper-animate-duration="15s" swiper-animate-delay="4s">
- <img src="images/b-y-2.png" class="ani img b-y-2 loop" swiper-animate-effect="moveLeft" swiper-animate-duration="15s" swiper-animate-delay="0s">
- <img src="images/b-y-3.png" class="ani img b-y-3 loop" swiper-animate-effect="moveRight" swiper-animate-duration="15s" swiper-animate-delay="0s">
- <div class="targetBtn clearfix ani" swiper-animate-effect="zoomInUp" swiper-animate-duration="1s" swiper-animate-delay="0.5s">
- <a class="a1" href="#">了解更多</a>
- <a class="a2" href="#" style="" rel="media-gallery"><i></i>观看视频介绍</a>
- </div>
- </div>
- </div>
- </div>
- <div class="pagination"></div>
- </div>
JavaScript Code
- <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>
原文地址:http://www.freejs.net/article_jiaodiantu_815.html