Authored by ccbikai

新品到着swiper 单张图片不进行初始化

@@ -17,10 +17,13 @@ var winH = $(window).height(), @@ -17,10 +17,13 @@ var winH = $(window).height(),
17 17
18 var swiper; 18 var swiper;
19 19
20 -swiper = new Swiper('.swiper-container', { 20 +// slide 个数大于 1 事,使用 swiper ,否则只显示单张图片
  21 +if ($('.swiper-container').length > 1) {
  22 + swiper = new Swiper('.swiper-container', {
21 lazyLoading: true, 23 lazyLoading: true,
22 pagination: '.swiper-pagination' 24 pagination: '.swiper-pagination'
23 -}); 25 + });
  26 +}
24 27
25 lazyLoad($('img.lazy')); 28 lazyLoad($('img.lazy'));
26 $curNav = $navList.children('.focus'); 29 $curNav = $navList.children('.focus');