Merge branch 'release/5.3' of git.yoho.cn:fe/yohobuywap-node into release/5.3
Showing
1 changed file
with
9 additions
and
7 deletions
@@ -11,12 +11,10 @@ var $ = require('yoho-jquery'), | @@ -11,12 +11,10 @@ var $ = require('yoho-jquery'), | ||
11 | 11 | ||
12 | require('./detail/page-render')(function() { | 12 | require('./detail/page-render')(function() { |
13 | var $discountFolder = $('.goods-discount .discount-folder'), | 13 | var $discountFolder = $('.goods-discount .discount-folder'), |
14 | - $discountArrow = $('.goods-discount .first-item span'), | ||
15 | - $bannerSwiper = $('.banner-swiper'); | 14 | + $discountArrow = $('.goods-discount .first-item span'); |
16 | 15 | ||
17 | var goodsDiscountEl = document.getElementById('goodsDiscount'), | 16 | var goodsDiscountEl = document.getElementById('goodsDiscount'), |
18 | goodsDiscountHammer = goodsDiscountEl && new Hammer(goodsDiscountEl), | 17 | goodsDiscountHammer = goodsDiscountEl && new Hammer(goodsDiscountEl), |
19 | - bannerSwiperHammer = new Hammer($bannerSwiper[0]), | ||
20 | $discountFirstItem = $(goodsDiscountEl).find('.first-item'); | 18 | $discountFirstItem = $(goodsDiscountEl).find('.first-item'); |
21 | 19 | ||
22 | var $cart = $('.cart-bar'); | 20 | var $cart = $('.cart-bar'); |
@@ -59,10 +57,14 @@ require('./detail/page-render')(function() { | @@ -59,10 +57,14 @@ require('./detail/page-render')(function() { | ||
59 | prevButton: '.my-swiper-button-prev', | 57 | prevButton: '.my-swiper-button-prev', |
60 | spaceBetween: 3 | 58 | spaceBetween: 3 |
61 | }); | 59 | }); |
62 | - bannerSwiperHammer.on('tap', function() { | ||
63 | - $('.banner-top').toggleClass('hover'); | ||
64 | - swiper.onResize(); | ||
65 | - }) | 60 | + if ($('.banner-swiper').length) { |
61 | + var bannerSwiperHammer = new Hammer($('.banner-swiper')[0]) | ||
62 | + bannerSwiperHammer.on('tap', function() { | ||
63 | + $('.banner-top').toggleClass('hover'); | ||
64 | + swiper.onResize(); | ||
65 | + }) | ||
66 | + } | ||
67 | + | ||
66 | 68 | ||
67 | // 初始化goods-discount | 69 | // 初始化goods-discount |
68 | if ($discountFolder.children().length === 0) { | 70 | if ($discountFolder.children().length === 0) { |
-
Please register or login to post a comment