Swiper制作网易智造首页响应式全屏宽度幻灯片
和网易智造一样的效果
XML/HTML Code
- <div class="swiper-container">
- <div class="swiper-wrapper">
- <div class="swiper-slide">
- <img data-src="images/1.jpg" class="swiper-lazy" alt="">
- </div>
- <div class="swiper-slide">
- <img data-src="images/2.jpg" class="swiper-lazy" alt="">
- </div>
- </div>
- <div class="swiper-pagination"></div>
- <span class="swiper-button-next"></span>
- <span class="swiper-button-prev"></span>
- </div>
JavaScript Code
- $(function () {
- var mySwiper = new Swiper('.swiper-container', {
- effect: 'fade',
- autoplay: true,
- loop: true,
- pagination: {
- el: '.swiper-pagination',
- clickable: true
- },
- navigation: {
- nextEl: '.swiper-button-next',
- prevEl: '.swiper-button-prev'
- },
- lazy: {
- loadPrevNext: true
- }
- })
- })
原文地址:http://www.freejs.net/article_jiaodiantu_780.html