Authored by ccbikai

Merge branch 'develop' of http://git.dev.yoho.cn/web/yohobuy into develop

@@ -52,14 +52,6 @@ if ($brandList.length > 0) { @@ -52,14 +52,6 @@ if ($brandList.length > 0) {
52 }); 52 });
53 } 53 }
54 54
55 -// $('#right-bar .con').find('b').unbind().on('tap', function() {  
56 -// var index = $(this).index();  
57 -  
58 -// if ($('.bar-' + index).size() > 0) {  
59 -// document.body.scrollTop = parseInt($('.bar-' + index)[0].offsetTop) - parseInt(brandSwipe - 1);  
60 -// }  
61 -// });  
62 -  
63 myHammer = new Hammer($('#right-bar .con').find('b').unbind()[0]); 55 myHammer = new Hammer($('#right-bar .con').find('b').unbind()[0]);
64 myHammer.on('tap', function(e) { 56 myHammer.on('tap', function(e) {
65 var index = $(this).index(); 57 var index = $(this).index();
@@ -7,6 +7,9 @@ var $ = require('jquery'), @@ -7,6 +7,9 @@ var $ = require('jquery'),
7 Hammer = require('hammer'), 7 Hammer = require('hammer'),
8 Swiper = require('yoho.iswiper'), 8 Swiper = require('yoho.iswiper'),
9 lazyLoad = require('yoho.lazyload'), 9 lazyLoad = require('yoho.lazyload'),
  10 + $mobileWrap = $('.mobile-wrap'),
  11 + $overlay = $('.overlay'),
  12 + $sideNav = $('.side-nav'),
10 bannerSwiper, 13 bannerSwiper,
11 recommendSwiper, 14 recommendSwiper,
12 hotBrandsSwiper, 15 hotBrandsSwiper,
@@ -28,31 +31,11 @@ require('./maybe-like'); @@ -28,31 +31,11 @@ require('./maybe-like');
28 31
29 lazyLoad($('img.lazy')); 32 lazyLoad($('img.lazy'));
30 33
31 -//$('img:in-viewport').trigger('appear');  
32 -  
33 -//点击首页汉堡menu图标,滑出侧栏导航  
34 -// $('.nav-btn').on('tap', function (event) {  
35 -// if (!$(this).hasClass('menu-open')) {  
36 -// $('.mobile-wrap').addClass('menu-open');  
37 -// $('.overlay').show().css('opacity', 0.3);  
38 -// $('.side-nav').addClass('on');  
39 -  
40 -// //设置boy高宽,页面不能上下滑动  
41 -// $('body').css({  
42 -// height: $(window).height(),  
43 -// width: '100%',  
44 -// overflow: 'hidden'  
45 -// });  
46 -// }  
47 -// event.stopPropagation();  
48 -// });  
49 -  
50 navHammer = new Hammer($('.nav-btn')[0]); 34 navHammer = new Hammer($('.nav-btn')[0]);
51 navHammer.on('tap', function(event) { 35 navHammer.on('tap', function(event) {
52 - if (!$(this).hasClass('menu-open')) {  
53 - $('.mobile-wrap').addClass('menu-open');  
54 - $('.overlay').show().css('opacity', 0.3);  
55 - $('.side-nav').addClass('on'); 36 + $mobileWrap.addClass('menu-open');
  37 + $overlay.show().css('opacity', 0.3);
  38 + $sideNav.addClass('on');
56 39
57 //设置boy高宽,页面不能上下滑动 40 //设置boy高宽,页面不能上下滑动
58 $('body').css({ 41 $('body').css({
@@ -60,35 +43,16 @@ navHammer.on('tap', function(event) { @@ -60,35 +43,16 @@ navHammer.on('tap', function(event) {
60 width: '100%', 43 width: '100%',
61 overflow: 'hidden' 44 overflow: 'hidden'
62 }); 45 });
63 - }  
64 -  
65 - // event.stopPropagation(); 46 + event.srcEvent.stopPropagation();
66 }); 47 });
67 48
68 -//点击页面主体,收起侧栏导航及二级导航  
69 -// $('.mobile-wrap').on('tap', function () {  
70 -// if ($(this).hasClass('menu-open')) {  
71 -// $('.mobile-wrap').removeClass('menu-open');  
72 -// $('.overlay').css('opacity', 0);  
73 -// $('.sub-nav').removeClass('show');  
74 -// $('.side-nav').removeClass('on');  
75 -// $('body').css({  
76 -// height: 'auto',  
77 -// overflow: 'auto'  
78 -// });  
79 -// setTimeout(function() {  
80 -// $('.overlay').hide();  
81 -// }, 300);  
82 -// }  
83 -// });  
84 -  
85 mobileWrapHammer = new Hammer($('.mobile-wrap')[0]); 49 mobileWrapHammer = new Hammer($('.mobile-wrap')[0]);
86 -mobileWrapHammer.on('tap', function(event) {  
87 - if ($(this).hasClass('menu-open')) {  
88 - $('.mobile-wrap').removeClass('menu-open');  
89 - $('.overlay').css('opacity', 0); 50 +mobileWrapHammer.on('tap', function(e) {
  51 + if ($mobileWrap.hasClass('menu-open')) {
  52 + $mobileWrap.removeClass('menu-open');
  53 + $overlay.css('opacity', 0);
90 $('.sub-nav').removeClass('show'); 54 $('.sub-nav').removeClass('show');
91 - $('.side-nav').removeClass('on'); 55 + $sideNav.removeClass('on');
92 $('body').css({ 56 $('body').css({
93 height: 'auto', 57 height: 'auto',
94 overflow: 'auto' 58 overflow: 'auto'
@@ -96,11 +60,12 @@ mobileWrapHammer.on('tap', function(event) { @@ -96,11 +60,12 @@ mobileWrapHammer.on('tap', function(event) {
96 setTimeout(function() { 60 setTimeout(function() {
97 $('.overlay').hide(); 61 $('.overlay').hide();
98 }, 300); 62 }, 300);
  63 + e.srcEvent.stopPropagation();
99 } 64 }
100 }); 65 });
101 66
102 //点击一级导航,弹出二级导航 67 //点击一级导航,弹出二级导航
103 -$('.side-nav').on('touchstart', 'li', function () { 68 +$sideNav.on('touchstart', 'li', function () {
104 if ($(this).find('.sub-nav').size() > 0) { 69 if ($(this).find('.sub-nav').size() > 0) {
105 $('.sub-nav').removeClass('show'); 70 $('.sub-nav').removeClass('show');
106 $(this).find('.sub-nav').addClass('show'); 71 $(this).find('.sub-nav').addClass('show');
@@ -115,13 +80,6 @@ $('.sub-nav').each(function () { @@ -115,13 +80,6 @@ $('.sub-nav').each(function () {
115 }); 80 });
116 }); 81 });
117 82
118 -//二级导航样式控制  
119 -$('.sub-nav').on('mouseenter', 'li', function () {  
120 - if ($(this).index() !== 0) {  
121 - $(this).addClass('current').siblings().removeClass('current');  
122 - }  
123 -});  
124 -  
125 //头部banner轮播 83 //头部banner轮播
126 if ($('.banner-swiper').find('li').size() > 1) { 84 if ($('.banner-swiper').find('li').size() > 1) {
127 bannerSwiper = new Swiper('.banner-swiper', { 85 bannerSwiper = new Swiper('.banner-swiper', {
@@ -99,11 +99,12 @@ $(window).scroll(function () { @@ -99,11 +99,12 @@ $(window).scroll(function () {
99 } 99 }
100 return; 100 return;
101 } 101 }
  102 +
102 $goodList.append(data); 103 $goodList.append(data);
  104 + num = $goodList.find('.good-info').length;
103 105
104 //lazyLoad 106 //lazyLoad
105 - //lazyLoad($goodList.children('.good-info:gt(' + (num - 1) + ')').find('img.lazy'));  
106 - lazyLoad($('.good-info').find('img.lazy')); 107 + lazyLoad($goodList.children('.good-info:gt(' + (num - 1) + ')').find('img.lazy'));
107 108
108 loading = false; 109 loading = false;
109 page++; 110 page++;
@@ -33,16 +33,18 @@ @@ -33,16 +33,18 @@
33 line-height: 90rem / $pxConvertRem; 33 line-height: 90rem / $pxConvertRem;
34 @include background-image(linear-gradient(#323232, #414141)); 34 @include background-image(linear-gradient(#323232, #414141));
35 position: relative; 35 position: relative;
  36 + z-index: 100;
36 .iconfont { 37 .iconfont {
37 color: #fff; 38 color: #fff;
38 } 39 }
39 40
40 .nav-btn { 41 .nav-btn {
41 position: absolute; 42 position: absolute;
42 - left: 32rem / $pxConvertRem; 43 + left: 0;
43 top: 0; 44 top: 0;
44 bottom: 0; 45 bottom: 0;
45 z-index: 2; 46 z-index: 2;
  47 + padding: 0 32rem / $pxConvertRem;
46 } 48 }
47 49
48 .logo { 50 .logo {