...
|
...
|
@@ -10,6 +10,7 @@ var $ = require('jquery'), |
|
|
$mobileWrap = $('.mobile-wrap'),
|
|
|
$overlay = $('.overlay'),
|
|
|
$sideNav = $('.side-nav'),
|
|
|
$subNav = $('.sub-nav'),
|
|
|
bannerSwiper,
|
|
|
recommendSwiper,
|
|
|
hotBrandsSwiper,
|
...
|
...
|
@@ -48,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);
|
...
|
...
|
@@ -62,28 +62,40 @@ 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;
|
|
|
});
|
|
|
|
|
|
//点击一级导航,弹出二级导航
|
|
|
$sideNav.on('touchend', 'li', function () {
|
|
|
$sideNav.on('touchend', 'li', function (e) {
|
|
|
if ($(this).find('.sub-nav').size() > 0) {
|
|
|
$('.sub-nav').removeClass('show');
|
|
|
$(this).find('.sub-nav').addClass('show');
|
|
|
}
|
|
|
return false;
|
|
|
e.stopPropagation();
|
|
|
if (e.target.pathname === location.pathname) {
|
|
|
hideSideBar();
|
|
|
return false;
|
|
|
}
|
|
|
});
|
|
|
|
|
|
//返回一级导航,收起二级导航
|
|
|
$('.sub-nav').each(function () {
|
|
|
$subNav.each(function () {
|
|
|
$(this).find('li').eq(0).on('touchend', function (e) {
|
|
|
$('.sub-nav').removeClass('show');
|
|
|
e.stopPropagation();
|
|
|
return false;
|
|
|
});
|
|
|
}).on('touchend', function() {
|
|
|
$('.sub-nav').find('li').removeClass('current');
|
|
|
}).on('touchend', function(e) {
|
|
|
if (e.currentTarget !== e.target) {
|
|
|
$subNav.find('li').removeClass('current');
|
|
|
}
|
|
|
});
|
|
|
|
|
|
//头部banner轮播
|
...
|
...
|
|