...
|
...
|
@@ -208,6 +208,7 @@ filter.registerCbFn(search); |
|
|
//5.当前active为筛选并且点击其他项时,隐藏筛选面板
|
|
|
$listNav.delegate('li', 'touchstart', function() {
|
|
|
var $this = $(this),
|
|
|
nav,
|
|
|
navType,
|
|
|
$active;
|
|
|
|
...
|
...
|
@@ -229,6 +230,17 @@ $listNav.delegate('li', 'touchstart', function() { |
|
|
filter.showFilter();
|
|
|
}
|
|
|
} else {
|
|
|
|
|
|
if ($this.hasClass('new')) {
|
|
|
navType = 'newest';
|
|
|
} else if ($this.hasClass('price')) {
|
|
|
navType = 'price';
|
|
|
} else if ($this.hasClass('discount')) {
|
|
|
navType = 'discount';
|
|
|
}
|
|
|
|
|
|
nav = navInfo[navType];
|
|
|
|
|
|
if ($this.hasClass('active')) {
|
|
|
|
|
|
//最新无排序切换
|
...
|
...
|
@@ -240,35 +252,44 @@ $listNav.delegate('li', 'touchstart', function() { |
|
|
|
|
|
// 价格/折扣切换排序状态
|
|
|
$this.find('.icon > .iconfont').toggleClass('cur');
|
|
|
$pre = $active; //更新pre为当前项
|
|
|
$pre = $this; //更新pre为当前项
|
|
|
nav.reload = true; //重置reload,HTML会被替换为逆序的HTML
|
|
|
nav.order = nav.order === 0 ? 1 : 0; //切换排序
|
|
|
}
|
|
|
} else {
|
|
|
$active = $this.siblings('.active');
|
|
|
|
|
|
$pre = $this; //$pre为除筛选导航的其他导航项,若当前active的为筛选,则把$pre置为当前点击项
|
|
|
|
|
|
if ($active.hasClass('filter')) {
|
|
|
$pre = $this; //$pre为除筛选导航的其他导航项,若当前active的为筛选,则把$pre置为当前点击项
|
|
|
|
|
|
//若之前active项为筛选,则隐藏筛选面板
|
|
|
filter.hideFilter();
|
|
|
} else {
|
|
|
$pre = $active;
|
|
|
|
|
|
//切换container显示
|
|
|
$goodsContainer.children('.container:not(.hide)').addClass('hide');
|
|
|
|
|
|
switch (navType) {
|
|
|
case 'newest':
|
|
|
$ngc.removeClass('hide');
|
|
|
break;
|
|
|
|
|
|
case 'price':
|
|
|
$pgc.removeClass('hide');
|
|
|
break;
|
|
|
|
|
|
case 'discount':
|
|
|
$dgc.removeClass('hide');
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
$active.removeClass('active');
|
|
|
$this.addClass('active');
|
|
|
|
|
|
$pre = $active;
|
|
|
}
|
|
|
|
|
|
if ($this.hasClass('new')) {
|
|
|
navType = 'newest';
|
|
|
} else if ($this.hasClass('price')) {
|
|
|
navType = 'price';
|
|
|
} else if ($this.hasClass('discount')) {
|
|
|
navType = 'discount';
|
|
|
}
|
|
|
|
|
|
if (navInfo[navType].reload) {
|
|
|
if (nav.reload) {
|
|
|
search();
|
|
|
}
|
|
|
}
|
...
|
...
|
|