Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
YOHOBUYWAP
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
xuqi
9 years ago
Commit
55d306489205ca48c4d4c5399de05d112a3835b4
1 parent
43f96dd6
filter in newsale
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
19 deletions
static/js/plugin/filter.js
static/js/product/newsale/newarrival.js
static/js/plugin/filter.js
View file @
55d3064
...
...
@@ -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
...
...
static/js/product/newsale/newarrival.js
View file @
55d3064
...
...
@@ -41,6 +41,8 @@ var defaultOpt = {
dayLimit
:
1
};
var
storeOpt
=
$
.
extend
({},
defaultOpt
);
//存储默认筛选条件以便重置
var
now
=
new
Date
(),
month
=
now
.
getMonth
()
+
1
,
date
=
now
.
getDate
();
...
...
@@ -267,8 +269,7 @@ $.ajax({
//切换active状态到$pre上
$pre
.
addClass
(
'active'
);
$pre
.
siblings
(
'.filter'
).
removeClass
(
'active'
);
},
missStatus
:
true
}
});
}
});
...
...
@@ -343,6 +344,10 @@ navHammer.on('tap', function(e) {
$dgc
.
removeClass
(
'hide'
);
break
;
}
//重置筛选项
filter
.
resetFilter
();
defaultOpt
=
$
.
extend
({},
storeOpt
);
}
$active
.
removeClass
(
'active'
);
...
...
Please
register
or
login
to post a comment