Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
yohoblk-wap
·
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
郝肖肖
9 years ago
Commit
68eb1ba9d47ded09e9ed64ff30f87635827b8073
1 parent
9885f5a8
全部品类事件
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
103 additions
and
21 deletions
public/js/channel/cate.page.js
public/scss/brand/_cate.css
public/js/channel/cate.page.js
View file @
68eb1ba
const
$
=
require
(
'yoho-jquery'
);
const
Vue
=
require
(
'yoho-vue'
);
const
resources
=
require
(
'channel/resources.vue'
);
const
letterList
=
require
(
'channel/letter-list.vue'
);
var
$nav
=
$
(
'.cate-nav'
),
$cateContainer
=
$
(
'.cate-container'
),
$contents
=
$cateContainer
.
children
(
'.content'
),
$subLevelItem
=
$cateContainer
.
find
(
'.sub-level li'
),
$primaryItem
=
$cateContainer
.
find
(
'.primary-level li'
);
require
(
'common/vue-filter
'
);
var
$curContent
=
$contents
.
not
(
'.hide
'
);
new
Vue
({
el
:
'#cate'
,
components
:
{
resources
,
letterList
(
function
()
{
var
$header
=
$
(
'.yoho-header'
),
$search
=
$
(
'#search-input'
);
var
h
=
$
(
window
).
height
()
-
$header
.
outerHeight
()
-
$search
.
outerHeight
()
-
$nav
.
outerHeight
();
$cateContainer
.
css
(
'min-height'
,
h
);
$contents
.
height
(
h
);
}());
$
(
'#search-input'
).
focus
(
function
()
{
$
(
this
).
blur
();
});
$nav
.
bind
(
'contextmenu'
,
function
()
{
return
false
;
});
$
(
'.cate-container'
).
bind
(
'contextmenu'
,
function
()
{
return
false
;
});
$nav
.
on
(
'touchend touchcancel'
,
function
(
e
)
{
var
$this
=
$
(
e
.
target
).
closest
(
'li'
),
index
=
$this
.
index
();
if
(
$this
.
hasClass
(
'focus'
))
{
return
;
}
$nav
.
find
(
'li.focus'
).
removeClass
(
'focus'
);
$this
.
addClass
(
'focus'
);
$curContent
.
addClass
(
'hide'
);
$curContent
=
$contents
.
eq
(
index
).
removeClass
(
'hide'
);
});
$cateContainer
.
on
(
'touchend'
,
function
(
e
)
{
var
$this
=
$
(
e
.
target
),
$subLevel
,
$cur
,
index
;
$cur
=
$this
.
closest
(
'.p-level-item'
);
if
(
$cur
.
length
>
0
)
{
index
=
$cur
.
index
();
$subLevel
=
$this
.
closest
(
'.content'
).
find
(
'.sub-level'
);
if
(
$this
.
hasClass
(
'focus'
))
{
return
;
}
$this
.
closest
(
'.primary-level'
).
children
(
'.focus'
).
removeClass
(
'focus'
);
$this
.
addClass
(
'focus'
);
$subLevel
.
not
(
'.hide'
).
addClass
(
'hide'
);
$subLevel
.
eq
(
index
).
removeClass
(
'hide'
);
}
});
$cateContainer
.
find
(
'.primary-level'
).
on
(
'touchstart touchend touchcancel'
,
'li'
,
function
()
{
$primaryItem
.
removeClass
(
'highlight'
);
$
(
this
).
addClass
(
'highlight'
);
}).
on
(
'touchend touchcancel'
,
'li'
,
function
()
{
$
(
this
).
removeClass
(
'highlight'
);
});
$cateContainer
.
find
(
'.sub-level'
).
on
(
'touchstart'
,
'li'
,
function
()
{
$subLevelItem
.
removeClass
(
'highlight'
);
$
(
this
).
addClass
(
'highlight'
);
}).
on
(
'touchend touchcancel'
,
'li'
,
function
()
{
$
(
this
).
removeClass
(
'highlight'
);
});
$nav
.
on
(
'touchstart'
,
'li'
,
function
()
{
$nav
.
find
(
'li'
).
removeClass
(
'bytouch'
);
$
(
this
).
addClass
(
'bytouch'
);
}).
on
(
'touchend touchcancel'
,
'li'
,
function
()
{
$nav
.
find
(
'li'
).
removeClass
(
'bytouch'
);
});
...
...
public/scss/brand/_cate.css
View file @
68eb1ba
...
...
@@ -50,10 +50,13 @@
box-sizing
:
border-box
;
float
:
left
;
height
:
100%
;
padding
:
20px
0
;
padding
:
20px
10px
;
width
:
25%
;
text-align
:
center
;
color
:
#999
;
white-space
:
nowrap
;
overflow
:
hidden
;
text-overflow
:
ellipsis
;
&:last-child
{
border-right
:
none
;
...
...
@@ -125,18 +128,6 @@
width
:
100%
;
background-color
:
#f6f6f6
;
&:before
{
content
:
""
;
width
:
0
;
height
:
0
;
border-top
:
20px
solid
transparent
;
border-bottom
:
20px
solid
transparent
;
border-right
:
20px
solid
#efefef
;
position
:
absolute
;
margin-top
:
32px
;
margin-left
:
-16px
;
}
&.hide
{
display
:
none
;
}
...
...
@@ -155,6 +146,22 @@
&
:last-child
{
border-bottom
:
none
;
}
&
:hover
{
background-color
:
#efefef
;
}
&
:first-child:before
{
content
:
""
;
width
:
0
;
height
:
0
;
border-top
:
20px
solid
transparent
;
border-bottom
:
20px
solid
transparent
;
border-right
:
20px
solid
#efefef
;
position
:
absolute
;
margin-top
:
32px
;
margin-left
:
-40px
;
}
}
a
{
...
...
Please
register
or
login
to post a comment