|
@@ -17,13 +17,6 @@ var missStatus; //是否忽略选中状态 |
|
@@ -17,13 +17,6 @@ var missStatus; //是否忽略选中状态 |
17
|
//隐藏筛选界面
|
17
|
//隐藏筛选界面
|
18
|
function hideFilter() {
|
18
|
function hideFilter() {
|
19
|
$filter.addClass('hide');
|
19
|
$filter.addClass('hide');
|
20
|
-
|
|
|
21
|
- if (missStatus) {
|
|
|
22
|
-
|
|
|
23
|
- //重置一级筛选项选中状态
|
|
|
24
|
- $filter.find('.classify-item.active').removeClass('active');
|
|
|
25
|
- $filter.find('.classify-item:first-child').addClass('active');
|
|
|
26
|
- }
|
|
|
27
|
}
|
20
|
}
|
28
|
|
21
|
|
29
|
//显示筛选界面
|
22
|
//显示筛选界面
|
|
@@ -31,6 +24,7 @@ function showFilter() { |
|
@@ -31,6 +24,7 @@ function showFilter() { |
31
|
$filter.removeClass('hide');
|
24
|
$filter.removeClass('hide');
|
32
|
}
|
25
|
}
|
33
|
|
26
|
|
|
|
27
|
+//主筛选项Tap事件句柄
|
34
|
function classifyTapEvt($this) {
|
28
|
function classifyTapEvt($this) {
|
35
|
if ($this.hasClass('active')) {
|
29
|
if ($this.hasClass('active')) {
|
36
|
return;
|
30
|
return;
|
|
@@ -41,9 +35,8 @@ function classifyTapEvt($this) { |
|
@@ -41,9 +35,8 @@ function classifyTapEvt($this) { |
41
|
$this.addClass('active');
|
35
|
$this.addClass('active');
|
42
|
}
|
36
|
}
|
43
|
|
37
|
|
44
|
-function subClassifyTapEvt($this) {
|
|
|
45
|
- var id = $this.data('id');
|
|
|
46
|
-
|
38
|
+//子筛选项选中处理
|
|
|
39
|
+function setSubClassify($this) {
|
47
|
var $sub = $this.closest('.sub-classify');
|
40
|
var $sub = $this.closest('.sub-classify');
|
48
|
|
41
|
|
49
|
var $shower = $sub.siblings('.shower');
|
42
|
var $shower = $sub.siblings('.shower');
|
|
@@ -72,6 +65,17 @@ function subClassifyTapEvt($this) { |
|
@@ -72,6 +65,17 @@ function subClassifyTapEvt($this) { |
72
|
$shower.removeClass('default');
|
65
|
$shower.removeClass('default');
|
73
|
}
|
66
|
}
|
74
|
|
67
|
|
|
|
68
|
+ return $sub;
|
|
|
69
|
+}
|
|
|
70
|
+
|
|
|
71
|
+//子筛选项Tap句柄
|
|
|
72
|
+function subClassifyTapEvt($this) {
|
|
|
73
|
+ var id = $this.data('id');
|
|
|
74
|
+
|
|
|
75
|
+ var $sub;
|
|
|
76
|
+
|
|
|
77
|
+ $sub = setSubClassify($this);
|
|
|
78
|
+
|
75
|
if (fCbFn) {
|
79
|
if (fCbFn) {
|
76
|
fCbFn({
|
80
|
fCbFn({
|
77
|
type: $sub.data('type'),
|
81
|
type: $sub.data('type'),
|
|
@@ -80,12 +84,6 @@ function subClassifyTapEvt($this) { |
|
@@ -80,12 +84,6 @@ function subClassifyTapEvt($this) { |
80
|
}
|
84
|
}
|
81
|
|
85
|
|
82
|
hideFilter();
|
86
|
hideFilter();
|
83
|
-
|
|
|
84
|
- //重置选中状态
|
|
|
85
|
- if (missStatus) {
|
|
|
86
|
- $this.removeClass('chosed');
|
|
|
87
|
- $sub.children(':first-child').addClass('chosed');
|
|
|
88
|
- }
|
|
|
89
|
}
|
87
|
}
|
90
|
|
88
|
|
91
|
//初始化筛选
|
89
|
//初始化筛选
|
|
@@ -133,8 +131,25 @@ function initFilter(opt) { |
|
@@ -133,8 +131,25 @@ function initFilter(opt) { |
133
|
});
|
131
|
});
|
134
|
}
|
132
|
}
|
135
|
|
133
|
|
|
|
134
|
+//重置筛选面板
|
|
|
135
|
+function resetFilter() {
|
|
|
136
|
+ if (typeof $filter === 'undefined') {
|
|
|
137
|
+ return;
|
|
|
138
|
+ }
|
|
|
139
|
+
|
|
|
140
|
+ //重置子筛选项
|
|
|
141
|
+ $('.sub-classify').each(function() {
|
|
|
142
|
+ setSubClassify($(this).children(':first-child'));
|
|
|
143
|
+ });
|
|
|
144
|
+
|
|
|
145
|
+ //重置主筛选项
|
|
|
146
|
+ classifyTapEvt($('.classify > :first-child'));
|
|
|
147
|
+}
|
|
|
148
|
+
|
136
|
exports.initFilter = initFilter;
|
149
|
exports.initFilter = initFilter;
|
137
|
|
150
|
|
138
|
exports.showFilter = showFilter;
|
151
|
exports.showFilter = showFilter;
|
139
|
|
152
|
|
140
|
exports.hideFilter = hideFilter;
|
153
|
exports.hideFilter = hideFilter;
|
|
|
154
|
+
|
|
|
155
|
+exports.resetFilter = resetFilter; |