修复了促销信息只有一条时的js bug --code reviewed by zhaobiao
Showing
1 changed file
with
2 additions
and
3 deletions
@@ -52,13 +52,13 @@ goodsSwiper = new Swiper('.banner-swiper', { | @@ -52,13 +52,13 @@ goodsSwiper = new Swiper('.banner-swiper', { | ||
52 | 52 | ||
53 | 53 | ||
54 | //初始化goods-discount | 54 | //初始化goods-discount |
55 | -if (0 === $('.goodsDiscount .discount-folder').children().length) { | 55 | +if (0 === $discountFolder.children().length) { |
56 | $discountFolder.css('display', 'none'); | 56 | $discountFolder.css('display', 'none'); |
57 | $discountArrow.html(''); | 57 | $discountArrow.html(''); |
58 | } | 58 | } |
59 | 59 | ||
60 | //goods-discount下拉按钮点击事件 | 60 | //goods-discount下拉按钮点击事件 |
61 | -if (goodsDiscountHammer) { | 61 | +if (goodsDiscountHammer && $discountFolder.children().length > 0) { |
62 | goodsDiscountHammer.on('tap', function(e) { | 62 | goodsDiscountHammer.on('tap', function(e) { |
63 | if ($discountFolder.is(':hidden')) { | 63 | if ($discountFolder.is(':hidden')) { |
64 | $discountArrow.removeClass('icon-down').addClass('icon-up').html(''); | 64 | $discountArrow.removeClass('icon-down').addClass('icon-up').html(''); |
@@ -67,7 +67,6 @@ if (goodsDiscountHammer) { | @@ -67,7 +67,6 @@ if (goodsDiscountHammer) { | ||
67 | $discountArrow.removeClass('icon-up').addClass('icon-down').html(''); | 67 | $discountArrow.removeClass('icon-up').addClass('icon-down').html(''); |
68 | $discountFolder.slideUp(); | 68 | $discountFolder.slideUp(); |
69 | } | 69 | } |
70 | - return false; | ||
71 | }); | 70 | }); |
72 | } | 71 | } |
73 | 72 |
-
Please register or login to post a comment