jQuery基于swiper制作华为云官网大气响应式的banner图片幻灯片轮播切换和产品列表布局代码。
使用方法
1、head引入css文件
<link rel="stylesheet" href="statics/css/swiper.css" /> <link rel="stylesheet" href="statics/css/animate.min.css" /> <link rel="stylesheet" href="statics/css/style.css" />2、head引入js文件
<script src="statics/js/jquery-1.10.1.min.js"></script> <script src="statics/js/swiper.min.js"></script> <script src="statics/js/swiper.animate1.0.2.min.js"></script>3、body引入HTML代码
<div class="swiper-container"> <div class="swiper-wrapper"> <div class="swiper-slide slide1"> </div> <div class="swiper-slide slide2"> <div class="inner"> <img src="statics/images/words2.png" class="ani img1" swiper-animate-effect="fadeInUp" swiper-animate-duration="2s" swiper-animate-delay="0.5s"> </div> </div> <div class="swiper-slide slide3"> </div> <div class="swiper-slide slide4"> <div class="inner"> <div class="banner-text ani" swiper-animate-effect="fadeInUp" swiper-animate-duration="2s" swiper-animate-delay="0.5s"> <h3><em>[ 限时免费 ]</em></h3> <h2>专属云<em>0元试用</em></h2> <p>专家团1V1量身定制,打造您的云上专属头等舱</p> <span class="btn-primary" href="javascript:">免费申请</span> </div> <img src="statics/images/image-main4-r.png" / class="ani img1" swiper-animate-effect="fadeInUp" swiper-animate-duration="1s" swiper-animate-delay="0.5s"> <img src="statics/images/image-sub4-r2.png" / class="ani img2" swiper-animate-effect="fadeInDown" swiper-animate-duration="2s" swiper-animate-delay="0.5s"> </div> </div> <div class="swiper-slide slide5"> <div class="inner"> <div class="banner-text ani" swiper-animate-effect="fadeInUp" swiper-animate-duration="2s" swiper-animate-delay="0.5s"> <h3><em>[ 限时免费 ]</em></h3> <h2>专属云<em>0元试用</em></h2> <p>专家团1V1量身定制,打造您的云上专属头等舱</p> <span class="btn-primary" href="javascript:">免费申请</span> </div> <img src="statics/images/image-main5-r.png" / class="ani img1" swiper-animate-effect="fadeInUp" swiper-animate-duration="1s" swiper-animate-delay="0.5s"> <img src="statics/images/image-sub5-r2.png" / class="ani img2" swiper-animate-effect="fadeInDown" swiper-animate-duration="2s" swiper-animate-delay="0.5s"> </div> </div> </div> <div class="pagination"></div> <div class="cover"></div> <div class="home-events"> <div class="home-events-box" style="min-height:30px;"> <div class="home-events-box-wrapper" style="min-height:30px;"> <div class="home-events-box-item"> <a href="#" target="_blank"> <i> <img src="statics/images/events-icon6.png" alt="免费体验专区"> <img src="statics/images/events-icon6-active.png" alt="免费体验专区"> </i> <h2>免费体验专区</h2> <p class="js-title" title="">热门云产品0元试用</p> </a> </div> <div class="home-events-box-item"> <a href="#" target="_blank"> <i> <img src="statics/images/events-icon1.png" alt="特惠专区"> <img src="statics/images/events-icon1-active.png" alt="特惠专区"> </i> <h2>特惠专区</h2> <p class="js-title" title="">云服务器首购5折</p> </a> </div> <div class="home-events-box-item"> <a href="#" target="_blank"> <i> <img src="statics/images/events-icon2.png" alt="严选商城"> <img src="statics/images/events-icon2-active.png" alt="严选商城"> </i> <h2>严选商城</h2> <p class="js-title" title="">精品应用 一键获取</p> </a> </div> <div class="home-events-box-item"> <a href="#" target="_blank"> <i> <img src="statics/images/events-icon9.png" alt="5分钟快速入门"> <img src="statics/images/events-icon9-active.png" alt="5分钟快速入门"> </i> <h2>5分钟快速入门</h2> <p class="js-title" title="">轻松上手华为云服务</p> </a> </div> </div> </div> </div> </div> <script> var mySwiper = new Swiper('.swiper-container', { pagination: '.pagination', paginationClickable: true, autoplay: 5000, speed: 1, loop:true, onInit: function(swiper) { swiperAnimateCache(swiper); //隐藏动画元素 swiperAnimate(swiper); //初始化完成开始动画 }, onSlideChangeEnd: function(swiper) { swiperAnimate(swiper); //每个slide切换结束时也运行当前slide动画 } }) </script>