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
afeda647c28c0932b55e109a1e40640188ef27a6
1 parent
f023eee5
my guang js
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
14 deletions
static/js/guang/info.js
static/js/me/my-guang.js
static/js/guang/info.js
View file @
afeda64
...
...
@@ -55,16 +55,17 @@ function initInfosEvt($container) {
cHammer
=
new
Hammer
(
$container
[
0
]);
//点赞或者收藏事件
cHammer
.
on
(
'tap'
,
function
(
e
)
{
var
$this
=
$
(
e
.
target
),
opt
=
'ok'
,
$likeBtn
,
$collectBtn
,
$btn
,
$info
;
$likeBtn
=
$this
.
closest
(
'.like-btn'
);
if
(
$likeBtn
.
length
>
0
)
{
if
(
$likeBtn
.
hasClass
(
'like'
))
{
//点赞
$btn
=
$this
.
closest
(
'.like-btn'
);
if
(
$btn
.
length
>
0
)
{
if
(
$btn
.
hasClass
(
'like'
))
{
opt
=
'cancel'
;
}
...
...
@@ -80,22 +81,23 @@ function initInfosEvt($container) {
var
code
=
data
.
code
;
if
(
code
===
200
)
{
$
likeB
tn
.
next
(
'.like-count'
).
text
(
data
.
data
);
$
b
tn
.
next
(
'.like-count'
).
text
(
data
.
data
);
//切换点赞状态
$
likeB
tn
.
toggleClass
(
'like'
);
$
b
tn
.
toggleClass
(
'like'
);
}
},
error
:
function
()
{
tip
.
show
(
'网络断开连接了~'
);
}
});
return
;
}
// 2015/11/03 hf: 增加APP里的收藏资讯功能. 写得不对的地方还请大神修改!
$collectBtn
=
$this
.
closest
(
'.collect-btn'
);
if
(
$collectBtn
.
length
>
0
)
{
if
(
$collectBtn
.
hasClass
(
'collected'
))
{
//APP收藏
$btn
=
$this
.
closest
(
'.collect-btn'
);
if
(
$btn
.
length
>
0
)
{
if
(
$btn
.
hasClass
(
'collected'
))
{
opt
=
'cancel'
;
}
...
...
@@ -111,7 +113,7 @@ function initInfosEvt($container) {
if
(
data
.
code
&&
data
.
code
===
200
)
{
//切换收藏状态
$
collectB
tn
.
toggleClass
(
'collected'
);
$
b
tn
.
toggleClass
(
'collected'
);
}
},
error
:
function
()
{
...
...
static/js/me/my-guang.js
View file @
afeda64
...
...
@@ -6,6 +6,22 @@
var
$
=
require
(
'jquery'
);
var
info
=
require
(
'../guang/info
'
);
var
$infoList
=
$
(
'#info-list
'
);
info
.
initInfoEvt
(
$
(
'#info-list'
));
\ No newline at end of file
var
winH
=
$
(
window
).
height
();
var
info
=
require
(
'../guang/info'
),
loadMore
=
info
.
loadMore
;
var
setting
=
{
page
:
2
,
end
:
false
};
info
.
initInfoEvt
(
$infoList
);
$
(
window
).
scroll
(
function
()
{
if
(
$
(
window
).
scrollTop
()
+
winH
>=
$
(
document
).
height
()
-
0.25
*
$infoList
.
height
())
{
loadMore
(
$infoList
,
setting
);
}
});
\ No newline at end of file
...
...
Please
register
or
login
to post a comment