diff --git a/js/javascript.js b/js/javascript.js index 6103985..fe906a1 100644 --- a/js/javascript.js +++ b/js/javascript.js @@ -1,31 +1,35 @@ jQuery(function($){ - // banner轮播 - var bannerSwiper = new Swiper('.banner-swiper',{ - loop:true,//开启循环播放 - autoplay: {//开启自动播放 - delay:3000, - disableOnInteraction: false,//触摸后不会停止自动滚动 - pauseOnMouseEnter: true,//鼠标置于swiper时暂停自动切换,鼠标离开时恢复自动切换。 - }, - pagination: { - el: '.banner-swiper .swiper-pagination', - clickable :true, - }, - effect : 'slide',//轮播的动效 默认为"slide"(普通位移切换),还可设置为"fade"(淡入)、"cube"(方块)、"coverflow"(3d流)、"flip"(3d翻转)、"cards"(卡片式)、"creative"(创意性)。 - // fadeEffect: { - // crossFade: true, - // }, - on:{ - init: function(){ - swiperAnimateCache(this); //隐藏动画元素 - swiperAnimate(this); //初始化完成开始动画 - }, - slideChangeTransitionEnd: function(){ - swiperAnimate(this); //每个slide切换结束时也运行当前slide动画 - // this.slides.eq(this.activeIndex).find('.ani').removeClass('ani'); 动画只展现一次,去除ani类名 - } - } - }); + // banner轮播 + var number = $('.banner-swiper .swiper-slide').length-2; + if(number>1){ + var bannerSwiper = new Swiper('.banner-swiper',{ + loop:true,//开启循环播放 + autoplay: {//开启自动播放 + delay:3000, + disableOnInteraction: false,//触摸后不会停止自动滚动 + pauseOnMouseEnter: true,//鼠标置于swiper时暂停自动切换,鼠标离开时恢复自动切换。 + }, + pagination: { + el: '.banner-swiper .swiper-pagination', + clickable :true, + }, + effect : 'slide',//轮播的动效 默认为"slide"(普通位移切换),还可设置为"fade"(淡入)、"cube"(方块)、"coverflow"(3d流)、"flip"(3d翻转)、"cards"(卡片式)、"creative"(创意性)。 + // fadeEffect: { + // crossFade: true, + // }, + on:{ + init: function(){ + swiperAnimateCache(this); //隐藏动画元素 + swiperAnimate(this); //初始化完成开始动画 + }, + slideChangeTransitionEnd: function(){ + swiperAnimate(this); //每个slide切换结束时也运行当前slide动画 + // this.slides.eq(this.activeIndex).find('.ani').removeClass('ani'); 动画只展现一次,去除ani类名 + } + } + }); + } + // 数据产品切换 $(".product-list li").eq(0).addClass("cur");