Showing
2 changed files
with
9 additions
and
24 deletions
@@ -6,22 +6,14 @@ | @@ -6,22 +6,14 @@ | ||
6 | 6 | ||
7 | 7 | ||
8 | var Swiper = require('yoho.iswiper'), | 8 | var Swiper = require('yoho.iswiper'), |
9 | - $ = require('jquery'); | 9 | + $ = require('jquery'), |
10 | + lazyLoad = require('yoho.lazyload'); | ||
10 | 11 | ||
11 | -var recommendSwiper, | ||
12 | - $recommendForYou = $('.recommend-for-you'); | 12 | +var $recommendForYou = $('.recommend-for-you'); |
13 | 13 | ||
14 | $.get('/product/recommend-for-you/cart').then(function(html) { | 14 | $.get('/product/recommend-for-you/cart').then(function(html) { |
15 | $recommendForYou.html(html).show(); | 15 | $recommendForYou.html(html).show(); |
16 | - if ($('#swiper-recommend').length) { | ||
17 | - recommendSwiper = new Swiper('#swiper-recommend', { | ||
18 | - slidesPerView: 'auto', | ||
19 | - grabCursor: true, | ||
20 | - slideElement: 'a', | ||
21 | - lazyLoading: true, | ||
22 | - watchSlidesVisibility: true | ||
23 | - }); | ||
24 | - } | 16 | + lazyLoad($('img.lazy')); |
25 | }).fail(function() { | 17 | }).fail(function() { |
26 | $recommendForYou.hide(); | 18 | $recommendForYou.hide(); |
27 | }); | 19 | }); |
@@ -6,22 +6,15 @@ | @@ -6,22 +6,15 @@ | ||
6 | 6 | ||
7 | 7 | ||
8 | var Swiper = require('yoho.iswiper'), | 8 | var Swiper = require('yoho.iswiper'), |
9 | - $ = require('jquery'); | 9 | + $ = require('jquery'), |
10 | + lazyLoad = require('yoho.lazyload'); | ||
10 | 11 | ||
11 | -var recommendSwiper, | ||
12 | - $recommendForYou = $('.recommend-for-you'); | 12 | +var $recommendForYou = $('.recommend-for-you'); |
13 | 13 | ||
14 | $.get('/product/recommend-for-you/userCenter').then(function(html) { | 14 | $.get('/product/recommend-for-you/userCenter').then(function(html) { |
15 | $recommendForYou.html(html).show(); | 15 | $recommendForYou.html(html).show(); |
16 | - if ($('#swiper-recommend').length) { | ||
17 | - recommendSwiper = new Swiper('#swiper-recommend', { | ||
18 | - slidesPerView: 'auto', | ||
19 | - grabCursor: true, | ||
20 | - slideElement: 'a', | ||
21 | - lazyLoading: true, | ||
22 | - watchSlidesVisibility: true | ||
23 | - }); | ||
24 | - } | 16 | + lazyLoad($('img.lazy')); |
17 | + | ||
25 | }).fail(function() { | 18 | }).fail(function() { |
26 | $recommendForYou.hide(); | 19 | $recommendForYou.hide(); |
27 | }); | 20 | }); |
-
Please register or login to post a comment