...
|
...
|
@@ -6,7 +6,7 @@ |
|
|
*/
|
|
|
|
|
|
var $ = require('jquery'),
|
|
|
Hammer = require('hammer');
|
|
|
Hammer = require('yoho.hammer');
|
|
|
|
|
|
var $filter;
|
|
|
|
...
|
...
|
@@ -17,13 +17,6 @@ var missStatus; //是否忽略选中状态 |
|
|
//隐藏筛选界面
|
|
|
function hideFilter() {
|
|
|
$filter.addClass('hide');
|
|
|
|
|
|
if (missStatus) {
|
|
|
|
|
|
//重置一级筛选项选中状态
|
|
|
$filter.find('.classify-item.active').removeClass('active');
|
|
|
$filter.find('.classify-item:first-child').addClass('active');
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//显示筛选界面
|
...
|
...
|
@@ -31,6 +24,7 @@ function showFilter() { |
|
|
$filter.removeClass('hide');
|
|
|
}
|
|
|
|
|
|
//主筛选项Tap事件句柄
|
|
|
function classifyTapEvt($this) {
|
|
|
if ($this.hasClass('active')) {
|
|
|
return;
|
...
|
...
|
@@ -41,9 +35,8 @@ function classifyTapEvt($this) { |
|
|
$this.addClass('active');
|
|
|
}
|
|
|
|
|
|
function subClassifyTapEvt($this) {
|
|
|
var id = $this.data('id');
|
|
|
|
|
|
//子筛选项选中处理
|
|
|
function setSubClassify($this) {
|
|
|
var $sub = $this.closest('.sub-classify');
|
|
|
|
|
|
var $shower = $sub.siblings('.shower');
|
...
|
...
|
@@ -72,6 +65,17 @@ function subClassifyTapEvt($this) { |
|
|
$shower.removeClass('default');
|
|
|
}
|
|
|
|
|
|
return $sub;
|
|
|
}
|
|
|
|
|
|
//子筛选项Tap句柄
|
|
|
function subClassifyTapEvt($this) {
|
|
|
var id = $this.data('id');
|
|
|
|
|
|
var $sub;
|
|
|
|
|
|
$sub = setSubClassify($this);
|
|
|
|
|
|
if (fCbFn) {
|
|
|
fCbFn({
|
|
|
type: $sub.data('type'),
|
...
|
...
|
@@ -80,12 +84,6 @@ function subClassifyTapEvt($this) { |
|
|
}
|
|
|
|
|
|
hideFilter();
|
|
|
|
|
|
//重置选中状态
|
|
|
if (missStatus) {
|
|
|
$this.removeClass('chosed');
|
|
|
$sub.children(':first-child').addClass('chosed');
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//初始化筛选
|
...
|
...
|
@@ -133,8 +131,25 @@ function initFilter(opt) { |
|
|
});
|
|
|
}
|
|
|
|
|
|
//重置筛选面板
|
|
|
function resetFilter() {
|
|
|
if (typeof $filter === 'undefined') {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
//重置子筛选项
|
|
|
$('.sub-classify').each(function() {
|
|
|
setSubClassify($(this).children(':first-child'));
|
|
|
});
|
|
|
|
|
|
//重置主筛选项
|
|
|
classifyTapEvt($('.classify > :first-child'));
|
|
|
}
|
|
|
|
|
|
exports.initFilter = initFilter;
|
|
|
|
|
|
exports.showFilter = showFilter;
|
|
|
|
|
|
exports.hideFilter = hideFilter; |
|
|
\ No newline at end of file |
|
|
exports.hideFilter = hideFilter;
|
|
|
|
|
|
exports.resetFilter = resetFilter; |
|
|
\ No newline at end of file |
...
|
...
|
|