Authored by biao

修复lifestyle有货币页面,code review by LZF

@@ -50,31 +50,33 @@ module.exports = function(specificGender) { @@ -50,31 +50,33 @@ module.exports = function(specificGender) {
50 $curNav = $navList.children('.focus'); 50 $curNav = $navList.children('.focus');
51 51
52 if (lifestyleType) { 52 if (lifestyleType) {
53 - navHammer = new Hammer($navList[0]);  
54 - navHammer.on('tap', function(e) {  
55 - var $this = $(e.target).closest('li'),  
56 - $goods = $('.goods-list'),  
57 - $content;  
58 -  
59 - e.preventDefault();  
60 - if ($this.hasClass('focus')) {  
61 - return;  
62 - } 53 + navHammer = $navList[0] ? new Hammer($navList[0]) : undefined;
  54 + if (navHammer) {
  55 + navHammer.on('tap', function(e) {
  56 + var $this = $(e.target).closest('li'),
  57 + $goods = $('.goods-list'),
  58 + $content;
  59 +
  60 + e.preventDefault();
  61 + if ($this.hasClass('focus')) {
  62 + return;
  63 + }
63 64
64 - index = $this.index(); 65 + index = $this.index();
65 66
66 - $this.addClass('focus');  
67 - $curNav.removeClass('focus'); 67 + $this.addClass('focus');
  68 + $curNav.removeClass('focus');
68 69
69 - $goods.not('.hide').addClass('hide');  
70 - $content = $goods.eq(index);  
71 - $content.removeClass('hide'); 70 + $goods.not('.hide').addClass('hide');
  71 + $content = $goods.eq(index);
  72 + $content.removeClass('hide');
72 73
73 - $curNav = $this; 74 + $curNav = $this;
74 75
75 - $(document).trigger('scroll'); //Trigger lazyLoad  
76 - e.srcEvent.stopPropagation();  
77 - }); 76 + $(document).trigger('scroll'); //Trigger lazyLoad
  77 + e.srcEvent.stopPropagation();
  78 + });
  79 + }
78 } 80 }
79 81
80 loading.init($('.maybe-like')); 82 loading.init($('.maybe-like'));