...
|
...
|
@@ -17,8 +17,7 @@ var $goodsContainer = $('#goods-container'), |
|
|
$pgc = $goodsContainer.find('.price-goods'),
|
|
|
$agc = $goodsContainer.find('.all-goods'),
|
|
|
$cgc = $goodsContainer.find('.category-goods'),
|
|
|
$sgc = $goodsContainer.find('.sale-goods'),
|
|
|
$newList = $('.new-list');
|
|
|
$sgc = $goodsContainer.find('.sale-goods');
|
|
|
|
|
|
var winH = $(window).height(),
|
|
|
noResult = '<p class="no-result">未找到相关搜索结果</p>';
|
...
|
...
|
@@ -384,18 +383,6 @@ $listNav.bind('contextmenu', function() { |
|
|
return false;
|
|
|
});
|
|
|
|
|
|
function newListHide() {
|
|
|
var $firstLi = $listNav.find('li.first-li-more');
|
|
|
|
|
|
if ($newList.hasClass('hide')) {
|
|
|
$firstLi.find('span.up').addClass('hide');
|
|
|
$firstLi.find('span.down').removeClass('hide');
|
|
|
} else {
|
|
|
$firstLi.find('span.down').addClass('hide');
|
|
|
$firstLi.find('span.up').removeClass('hide');
|
|
|
}
|
|
|
}
|
|
|
|
|
|
$listNav.on('touchend touchcancel', function(e) {
|
|
|
var $this = $(e.target).closest('li'),
|
|
|
nav,
|
...
|
...
|
@@ -408,23 +395,6 @@ $listNav.on('touchend touchcancel', function(e) { |
|
|
return;
|
|
|
}
|
|
|
|
|
|
if ($this.hasClass('first-li-more')) {
|
|
|
filter.hideFilter();
|
|
|
$newList.toggleClass('hide');
|
|
|
if ($this.hasClass('default')) {
|
|
|
$newList.find('li.default').addClass('active').siblings().removeClass('active');
|
|
|
} else if ($this.hasClass('new')) {
|
|
|
$newList.find('li.new').addClass('active').siblings().removeClass('active');
|
|
|
} else if ($this.hasClass('sale')) {
|
|
|
$newList.find('li.sale').addClass('active').siblings().removeClass('active');
|
|
|
}
|
|
|
newListHide();
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
// 最新li 列表
|
|
|
$newList.addClass('hide');
|
|
|
|
|
|
if ($this.hasClass('filter')) {
|
|
|
|
|
|
// 筛选面板切换状态
|
...
|
...
|
@@ -452,7 +422,8 @@ $listNav.on('touchend touchcancel', function(e) { |
|
|
if ($this.hasClass('active')) {
|
|
|
|
|
|
// 最新无排序切换
|
|
|
if ($this.hasClass('new') || $this.hasClass('sale') || $this.hasClass('all')) {
|
|
|
if ($this.hasClass('default') || $this.hasClass('new') ||
|
|
|
$this.hasClass('sale') || $this.hasClass('all')) {
|
|
|
return;
|
|
|
}
|
|
|
|
...
|
...
|
@@ -551,69 +522,6 @@ $listNav.on('touchstart', 'li', function() { |
|
|
$listNav.find('li').removeClass('bytouch');
|
|
|
});
|
|
|
|
|
|
$newList.on('touchstart', 'li', function(e) {
|
|
|
var navType,
|
|
|
$firstLiDom = $listNav.find('li.first-li-more');
|
|
|
|
|
|
e.preventDefault();
|
|
|
|
|
|
if ($(this).hasClass('new')) {
|
|
|
navType = 'new';
|
|
|
} else if ($(this).hasClass('default')) {
|
|
|
navType = 'default';
|
|
|
} else if ($(this).hasClass('sale')) {
|
|
|
navType = 'sale';
|
|
|
}
|
|
|
|
|
|
$newList.addClass('hide');
|
|
|
$firstLiDom.find('.span-test').text($(this).text());
|
|
|
$firstLiDom.addClass('active').siblings().removeClass('active');
|
|
|
$listNav.find('.first-li-more').removeClass('new default sale').addClass(navType);
|
|
|
|
|
|
newListHide();
|
|
|
|
|
|
if ($(this).hasClass('active')) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
// 切换container显示
|
|
|
$goodsContainer.children('.container:not(.hide)').addClass('hide');
|
|
|
|
|
|
switch (navType) {
|
|
|
case 'new':
|
|
|
$ngc.removeClass('hide');
|
|
|
break;
|
|
|
|
|
|
case 'price':
|
|
|
$pgc.removeClass('hide');
|
|
|
break;
|
|
|
|
|
|
case 'discount':
|
|
|
$dgc.removeClass('hide');
|
|
|
break;
|
|
|
|
|
|
case 'default':
|
|
|
$defaultgc.removeClass('hide');
|
|
|
break;
|
|
|
|
|
|
case 'sale':
|
|
|
$sgc.removeClass('hide');
|
|
|
break;
|
|
|
default:
|
|
|
break;
|
|
|
}
|
|
|
$pre = $firstLiDom;
|
|
|
search({filtering: true});
|
|
|
});
|
|
|
|
|
|
$(document).on('touchstart', function(e) {
|
|
|
if (!$newList.hasClass('hide') &&
|
|
|
$(e.target).closest('.new-list, li.first-li-more').length <= 0) {
|
|
|
$newList.addClass('hide');
|
|
|
newListHide();
|
|
|
}
|
|
|
});
|
|
|
|
|
|
module.exports = {
|
|
|
start: search
|
|
|
}; |
...
|
...
|
|