Authored by xuqi

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

@@ -10,6 +10,7 @@ var $ = require('jquery'), @@ -10,6 +10,7 @@ var $ = require('jquery'),
10 $mobileWrap = $('.mobile-wrap'), 10 $mobileWrap = $('.mobile-wrap'),
11 $overlay = $('.overlay'), 11 $overlay = $('.overlay'),
12 $sideNav = $('.side-nav'), 12 $sideNav = $('.side-nav'),
  13 + $subNav = $('.sub-nav'),
13 bannerSwiper, 14 bannerSwiper,
14 recommendSwiper, 15 recommendSwiper,
15 hotBrandsSwiper, 16 hotBrandsSwiper,
@@ -48,8 +49,7 @@ navHammer.on('tap', function(event) { @@ -48,8 +49,7 @@ navHammer.on('tap', function(event) {
48 return false; 49 return false;
49 }); 50 });
50 51
51 -mobileWrapHammer = new Hammer($('.mobile-wrap')[0]);  
52 -mobileWrapHammer.on('tap', function(e) { 52 +function hideSideBar() {
53 if ($mobileWrap.hasClass('menu-open')) { 53 if ($mobileWrap.hasClass('menu-open')) {
54 $mobileWrap.removeClass('menu-open'); 54 $mobileWrap.removeClass('menu-open');
55 $overlay.css('opacity', 0); 55 $overlay.css('opacity', 0);
@@ -62,28 +62,40 @@ mobileWrapHammer.on('tap', function(e) { @@ -62,28 +62,40 @@ mobileWrapHammer.on('tap', function(e) {
62 setTimeout(function() { 62 setTimeout(function() {
63 $('.overlay').hide(); 63 $('.overlay').hide();
64 }, 300); 64 }, 300);
65 - e.srcEvent.stopPropagation();  
66 - return false;  
67 } 65 }
  66 +}
  67 +
  68 +mobileWrapHammer = new Hammer($('.mobile-wrap')[0]);
  69 +mobileWrapHammer.on('tap', function(e) {
  70 + hideSideBar();
  71 + e.srcEvent.stopPropagation();
  72 + return false;
68 }); 73 });
69 74
70 //点击一级导航,弹出二级导航 75 //点击一级导航,弹出二级导航
71 -$sideNav.on('touchend', 'li', function () { 76 +$sideNav.on('touchend', 'li', function (e) {
72 if ($(this).find('.sub-nav').size() > 0) { 77 if ($(this).find('.sub-nav').size() > 0) {
73 $('.sub-nav').removeClass('show'); 78 $('.sub-nav').removeClass('show');
74 $(this).find('.sub-nav').addClass('show'); 79 $(this).find('.sub-nav').addClass('show');
75 } 80 }
76 - return false; 81 + e.stopPropagation();
  82 + if (e.target.pathname === location.pathname) {
  83 + hideSideBar();
  84 + return false;
  85 + }
77 }); 86 });
78 87
79 //返回一级导航,收起二级导航 88 //返回一级导航,收起二级导航
80 -$('.sub-nav').each(function () { 89 +$subNav.each(function () {
81 $(this).find('li').eq(0).on('touchend', function (e) { 90 $(this).find('li').eq(0).on('touchend', function (e) {
82 $('.sub-nav').removeClass('show'); 91 $('.sub-nav').removeClass('show');
  92 + e.stopPropagation();
83 return false; 93 return false;
84 }); 94 });
85 -}).on('touchend', function() {  
86 - $('.sub-nav').find('li').removeClass('current'); 95 +}).on('touchend', function(e) {
  96 + if (e.currentTarget !== e.target) {
  97 + $subNav.find('li').removeClass('current');
  98 + }
87 }); 99 });
88 100
89 //头部banner轮播 101 //头部banner轮播
1 .side-nav { 1 .side-nav {
2 - display: table-cell; 2 + display: block;
3 background: #fff; 3 background: #fff;
4 position: fixed; 4 position: fixed;
5 top: 0; 5 top: 0;
6 bottom: 0; 6 bottom: 0;
  7 + // left: 0;
7 right: 640rem / $pxConvertRem; 8 right: 640rem / $pxConvertRem;
8 width: 540rem / $pxConvertRem; 9 width: 540rem / $pxConvertRem;
9 z-index: -1; 10 z-index: -1;
@@ -116,8 +117,9 @@ @@ -116,8 +117,9 @@
116 bottom: 0; 117 bottom: 0;
117 top: 0; 118 top: 0;
118 left: 0; 119 left: 0;
119 - width: 100%; 120 + width: 540rem / $pxConvertRem;
120 background: #fff !important; 121 background: #fff !important;
  122 + overflow: hidden;
121 123
122 @include transform(translateX(540rem / $pxConvertRem)); 124 @include transform(translateX(540rem / $pxConvertRem));
123 @include transition(transform 0.3s); 125 @include transition(transform 0.3s);
1 .search-page { 1 .search-page {
2 .search-input { 2 .search-input {
3 position: relative; 3 position: relative;
4 - padding: 7px 46px 7px 15px; 4 + padding: 7px 98px 7px 15px;
5 background: #f8f8f8; 5 background: #f8f8f8;
6 6
7 .search-icon { 7 .search-icon {
@@ -16,7 +16,7 @@ @@ -16,7 +16,7 @@
16 height: 30px; 16 height: 30px;
17 width: 100%; 17 width: 100%;
18 border-radius: 15px; 18 border-radius: 15px;
19 - text-indent: 26px; 19 + padding: 0 26px;
20 background: #fff; 20 background: #fff;
21 border: none; 21 border: none;
22 } 22 }