Showing
1 changed file
with
5 additions
and
2 deletions
@@ -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'); |
-
Please register or login to post a comment