Authored by ccbikai

侧边栏点击穿透

@@ -45,6 +45,7 @@ navHammer.on('tap', function(event) { @@ -45,6 +45,7 @@ navHammer.on('tap', function(event) {
45 }); 45 });
46 46
47 event.srcEvent.stopPropagation(); 47 event.srcEvent.stopPropagation();
  48 + return false;
48 }); 49 });
49 50
50 mobileWrapHammer = new Hammer($('.mobile-wrap')[0]); 51 mobileWrapHammer = new Hammer($('.mobile-wrap')[0]);
@@ -62,11 +63,12 @@ mobileWrapHammer.on('tap', function(e) { @@ -62,11 +63,12 @@ mobileWrapHammer.on('tap', function(e) {
62 $('.overlay').hide(); 63 $('.overlay').hide();
63 }, 300); 64 }, 300);
64 e.srcEvent.stopPropagation(); 65 e.srcEvent.stopPropagation();
  66 + return false;
65 } 67 }
66 }); 68 });
67 69
68 //点击一级导航,弹出二级导航 70 //点击一级导航,弹出二级导航
69 -$sideNav.on('touchstart', 'li', function () { 71 +$sideNav.on('touchend', 'li', function () {
70 if ($(this).find('.sub-nav').size() > 0) { 72 if ($(this).find('.sub-nav').size() > 0) {
71 $('.sub-nav').removeClass('show'); 73 $('.sub-nav').removeClass('show');
72 $(this).find('.sub-nav').addClass('show'); 74 $(this).find('.sub-nav').addClass('show');
@@ -75,10 +77,12 @@ $sideNav.on('touchstart', 'li', function () { @@ -75,10 +77,12 @@ $sideNav.on('touchstart', 'li', function () {
75 77
76 //返回一级导航,收起二级导航 78 //返回一级导航,收起二级导航
77 $('.sub-nav').each(function () { 79 $('.sub-nav').each(function () {
78 - $(this).find('li').eq(0).on('touchstart', function (e) { 80 + $(this).find('li').eq(0).on('touchend', function (e) {
79 $('.sub-nav').removeClass('show'); 81 $('.sub-nav').removeClass('show');
80 - e.stopPropagation(); 82 + return false;
81 }); 83 });
  84 +}).on('touchend', function() {
  85 + $('.sub-nav').find('li').removeClass('current');
82 }); 86 });
83 87
84 //头部banner轮播 88 //头部banner轮播
@@ -110,12 +110,12 @@ @@ -110,12 +110,12 @@
110 } 110 }
111 111
112 .sub-nav { 112 .sub-nav {
113 - // display: none; 113 + display: none;
114 position: fixed; 114 position: fixed;
  115 + bottom: 0;
115 top: 0; 116 top: 0;
116 - right: 100rem / $pxConvertRem;  
117 left: 0; 117 left: 0;
118 - bottom: 0; 118 + // right: 100rem / $pxConvertRem;
119 width: 100%; 119 width: 100%;
120 background: #fff !important; 120 background: #fff !important;
121 // z-index: 2; 121 // z-index: 2;
@@ -185,7 +185,7 @@ @@ -185,7 +185,7 @@
185 } 185 }
186 186
187 .sub-nav.show { 187 .sub-nav.show {
  188 + display: block;
188 @include transform(translateX(0)); 189 @include transform(translateX(0));
189 -  
190 @include transition(transform 0.3s); 190 @include transition(transform 0.3s);
191 } 191 }