Showing
1 changed file
with
25 additions
and
23 deletions
@@ -19,29 +19,31 @@ require('./good'); | @@ -19,29 +19,31 @@ require('./good'); | ||
19 | 19 | ||
20 | lazyLoad($('img.lazy')); | 20 | lazyLoad($('img.lazy')); |
21 | 21 | ||
22 | -navHammer = new Hammer(document.getElementsByClassName('cart-nav')[0]); | ||
23 | -navHammer.on('tap', function(e) { | ||
24 | - var $this = $(e.target).closest('li'); | ||
25 | - | ||
26 | - if ($this.hasClass('active')) { | ||
27 | - return; | ||
28 | - } | ||
29 | - | ||
30 | - if (cartType === 'ordinary') { | ||
31 | - cartType = 'advance'; | ||
32 | - } else { | ||
33 | - cartType = 'ordinary'; | ||
34 | - } | ||
35 | - | ||
36 | - $this.siblings('.active').removeClass('active'); | ||
37 | - $this.addClass('active'); | ||
38 | - | ||
39 | - //切换普通商品和预售商品购物车显示 | ||
40 | - $cartContent.toggleClass('hide'); | ||
41 | - | ||
42 | - //trigger lazyload | ||
43 | - $(window).trigger('scroll'); | ||
44 | -}); | 22 | +if ($('.cart-nav').length > 0) { |
23 | + navHammer = new Hammer(document.getElementsByClassName('cart-nav')[0]); | ||
24 | + navHammer.on('tap', function(e) { | ||
25 | + var $this = $(e.target).closest('li'); | ||
26 | + | ||
27 | + if ($this.hasClass('active')) { | ||
28 | + return; | ||
29 | + } | ||
30 | + | ||
31 | + if (cartType === 'ordinary') { | ||
32 | + cartType = 'advance'; | ||
33 | + } else { | ||
34 | + cartType = 'ordinary'; | ||
35 | + } | ||
36 | + | ||
37 | + $this.siblings('.active').removeClass('active'); | ||
38 | + $this.addClass('active'); | ||
39 | + | ||
40 | + //切换普通商品和预售商品购物车显示 | ||
41 | + $cartContent.toggleClass('hide'); | ||
42 | + | ||
43 | + //trigger lazyload | ||
44 | + $(window).trigger('scroll'); | ||
45 | + }); | ||
46 | +} | ||
45 | 47 | ||
46 | $('.btn-balance').on('touchend', function() { | 48 | $('.btn-balance').on('touchend', function() { |
47 | window.location.href = '/cart/index/orderEnsure?cartType=' + cartType; | 49 | window.location.href = '/cart/index/orderEnsure?cartType=' + cartType; |
-
Please register or login to post a comment