Authored by ccbikai

侧边栏点击当前栏目不刷新

... ... @@ -49,8 +49,7 @@ navHammer.on('tap', function(event) {
return false;
});
mobileWrapHammer = new Hammer($('.mobile-wrap')[0]);
mobileWrapHammer.on('tap', function(e) {
function hideSideBar() {
if ($mobileWrap.hasClass('menu-open')) {
$mobileWrap.removeClass('menu-open');
$overlay.css('opacity', 0);
... ... @@ -63,9 +62,14 @@ mobileWrapHammer.on('tap', function(e) {
setTimeout(function() {
$('.overlay').hide();
}, 300);
e.srcEvent.stopPropagation();
return false;
}
}
mobileWrapHammer = new Hammer($('.mobile-wrap')[0]);
mobileWrapHammer.on('tap', function(e) {
hideSideBar();
e.srcEvent.stopPropagation();
return false;
});
//点击一级导航,弹出二级导航
... ... @@ -75,6 +79,10 @@ $sideNav.on('touchend', 'li', function (e) {
$(this).find('.sub-nav').addClass('show');
}
e.stopPropagation();
if (e.target.pathname === location.pathname) {
hideSideBar();
return false;
}
});
//返回一级导航,收起二级导航
... ...