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
梁志锋
9 years ago
Commit
e74c0d5ebbae3a80ea93ba85089850dd7c06d25f
1 parent
e5b57bc3
use requestAnimationFrame for scroll event
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
75 additions
and
21 deletions
static/js/category/brand.js
static/js/guang/home.js
static/js/guang/list.js
static/js/home/maybe-like.js
static/js/me/fav.js
static/js/me/my-guang.js
static/js/me/order.js
static/js/product/detail/loadmore.js
static/js/product/list.js
static/js/product/newsale/discount.js
static/js/product/newsale/hot-rank.js
static/js/product/newsale/newarrival.js
static/js/category/brand.js
View file @
e74c0d5
...
...
@@ -45,7 +45,7 @@ $fixTitleBar.css({
minBrandListTop
=
brandSwipe
+
$
(
'.hot-brand'
).
outerHeight
()
+
$
(
'.banner-top'
).
outerHeight
();
$brandList
.
last
().
append
(
$fixTitleBar
);
$
(
window
).
scroll
(
function
()
{
function
scrollHandler
()
{
var
scrTop
=
$
(
window
).
scrollTop
();
if
(
$brandList
.
eq
(
0
).
offset
().
top
<
minBrandListTop
)
{
...
...
@@ -62,8 +62,14 @@ $(window).scroll(function() {
}
});
}
//srcoll to load more
$
(
window
).
scroll
(
function
()
{
window
.
requestAnimationFrame
(
scrollHandler
);
});
function
changeBackground
()
{
var
$brandList
=
$
(
'.brand-list'
).
find
(
'p'
);
...
...
static/js/guang/home.js
View file @
e74c0d5
...
...
@@ -107,12 +107,17 @@ $nav.on('touchend touchcancel', function(e) {
}
});
$
(
document
).
scroll
(
function
()
{
function
scrollHandler
()
{
var
$c
=
$infos
.
not
(
'.hide'
);
if
(
$
(
window
).
scrollTop
()
+
winH
>=
$
(
document
).
height
()
-
0.25
*
$c
.
height
())
{
loadMore
(
$c
,
state
[
curType
]);
}
}
//srcoll to load more
$
(
document
).
scroll
(
function
()
{
window
.
requestAnimationFrame
(
scrollHandler
);
});
$nav
.
on
(
'touchstart'
,
function
(
e
)
{
...
...
static/js/guang/list.js
View file @
e74c0d5
...
...
@@ -40,8 +40,13 @@ if ($tag.length > 0) {
});
}
$
(
document
).
scroll
(
function
()
{
function
scrollHandler
()
{
if
(
$
(
window
).
scrollTop
()
+
winH
>=
$
(
document
).
height
()
-
0.25
*
$infos
.
height
())
{
loadMore
(
$infos
,
setting
);
}
});
\ No newline at end of file
}
//srcoll to load more
$
(
window
).
scroll
(
function
()
{
window
.
requestAnimationFrame
(
scrollHandler
);
});
...
...
static/js/home/maybe-like.js
View file @
e74c0d5
...
...
@@ -137,9 +137,13 @@ $('.maybe-like p').on('touchstart', function (e) {
search
();
});
//srcoll to load more
$
(
window
).
scroll
(
function
()
{
function
scrollHandler
()
{
if
(
$
(
window
).
scrollTop
()
+
winH
>=
$
(
document
).
height
()
-
50
)
{
search
();
}
}
//srcoll to load more
$
(
window
).
scroll
(
function
()
{
window
.
requestAnimationFrame
(
scrollHandler
);
});
\ No newline at end of file
...
...
static/js/me/fav.js
View file @
e74c0d5
...
...
@@ -206,14 +206,11 @@ favContentHammer.on('tap', function(e) {
});
});
// 上拉加载更多
$
(
document
).
scroll
(
function
()
{
function
scrollHandler
()
{
if
(
$
(
window
).
scrollTop
()
+
winH
>=
$
(
document
).
height
()
-
footerH
)
{
if
(
brandTab
)
{
console
.
log
(
1
);
$brandLoadMore
.
filter
(
'.hide'
).
removeClass
(
'hide'
);
if
(
!
brandLockId
)
{
...
...
@@ -231,4 +228,9 @@ $(document).scroll(function() {
}
}
}
}
//srcoll to load more
$
(
window
).
scroll
(
function
()
{
window
.
requestAnimationFrame
(
scrollHandler
);
});
\ No newline at end of file
...
...
static/js/me/my-guang.js
View file @
e74c0d5
...
...
@@ -18,13 +18,21 @@ var setting = {
end
:
false
};
function
scrollHandler
()
{
if
(
$
(
window
).
scrollTop
()
+
winH
>=
$
(
document
).
height
()
-
0.25
*
$infoList
.
height
())
{
loadMore
(
$infoList
,
setting
,
'/home/myguang'
);
}
}
//对于有逛收藏的页面进行事件处理
if
(
$infoList
.
length
>
0
)
{
info
.
initInfosEvt
(
$infoList
);
//srcoll to load more
$
(
window
).
scroll
(
function
()
{
if
(
$
(
window
).
scrollTop
()
+
winH
>=
$
(
document
).
height
()
-
0.25
*
$infoList
.
height
())
{
loadMore
(
$infoList
,
setting
,
'/home/myguang'
);
}
window
.
requestAnimationFrame
(
scrollHandler
);
});
}
\ No newline at end of file
}
...
...
static/js/me/order.js
View file @
e74c0d5
...
...
@@ -167,7 +167,7 @@ orderHammer.on('tap', function(e) {
}
});
$
(
window
).
scroll
(
function
()
{
function
scrollHandler
()
{
if
(
order
.
end
===
false
&&
$
(
window
).
scrollTop
()
+
winH
>
$
(
document
).
height
()
-
0.25
*
$orderContainer
.
height
())
{
...
...
@@ -176,6 +176,11 @@ $(window).scroll(function() {
noLoadingMask
:
true
});
}
}
//srcoll to load more
$
(
window
).
scroll
(
function
()
{
window
.
requestAnimationFrame
(
scrollHandler
);
});
//初始化请求第一页数据
...
...
static/js/product/detail/loadmore.js
View file @
e74c0d5
...
...
@@ -99,5 +99,4 @@ function scrollHandler() {
//srcoll to load more
$
(
window
).
scroll
(
function
()
{
window
.
requestAnimationFrame
(
scrollHandler
);
});
});
\ No newline at end of file
...
...
static/js/product/list.js
View file @
e74c0d5
...
...
@@ -362,13 +362,18 @@ $listNav.on('touchend touchcancel', function(e) {
}
});
$
(
window
).
scroll
(
function
()
{
function
scrollHandler
()
{
//当scroll到1/4$goodsContainer高度后继续请求下一页数据
if
(
$
(
window
).
scrollTop
()
+
winH
>
$
(
document
).
height
()
-
0.25
*
$goodsContainer
.
height
())
{
search
();
}
}
//srcoll to load more
$
(
window
).
scroll
(
function
()
{
window
.
requestAnimationFrame
(
scrollHandler
);
});
if
(
$brandHeader
.
length
>
0
)
{
...
...
static/js/product/newsale/discount.js
View file @
e74c0d5
...
...
@@ -351,7 +351,7 @@ $listNav.on('touchend touchcancel', function(e) {
e
.
stopPropagation
();
});
$
(
window
).
scroll
(
function
()
{
function
scrollHandler
()
{
//当scroll到1/4$goodsContainer高度后继续请求下一页数据
if
(
$
(
window
).
scrollTop
()
+
winH
>
...
...
@@ -360,6 +360,11 @@ $(window).scroll(function() {
search
();
}
}
}
//srcoll to load more
$
(
window
).
scroll
(
function
()
{
window
.
requestAnimationFrame
(
scrollHandler
);
});
//初始请求最新第一页数据
...
...
static/js/product/newsale/hot-rank.js
View file @
e74c0d5
...
...
@@ -53,7 +53,7 @@ function hotrank(page, sort, tabId, notab) {
});
}
$
(
window
).
scroll
(
function
()
{
function
scrollHandler
()
{
if
(
page
===
2
)
{
return
;
}
...
...
@@ -63,8 +63,13 @@ $(window).scroll(function () {
page
=
2
;
notab
=
1
;
hotrank
(
page
,
sort
,
id
,
notab
);
}
//srcoll to load more
$
(
window
).
scroll
(
function
()
{
window
.
requestAnimationFrame
(
scrollHandler
);
});
hotrank
(
page
,
sort
,
id
,
notab
);
hotnav
=
new
Hammer
(
document
.
getElementById
(
'hotRank'
));
hotnav
.
on
(
'tap'
,
function
(
e
)
{
...
...
static/js/product/newsale/newarrival.js
View file @
e74c0d5
...
...
@@ -359,7 +359,7 @@ $listNav.on('touchend touchcancel', function(e) {
e
.
stopPropagation
();
});
$
(
window
).
scroll
(
function
()
{
function
scrollHandler
()
{
//当scroll到1/4$goodsContainer高度后继续请求下一页数据
if
(
$
(
window
).
scrollTop
()
+
winH
>
...
...
@@ -368,6 +368,11 @@ $(window).scroll(function() {
search
();
}
}
}
//srcoll to load more
$
(
window
).
scroll
(
function
()
{
window
.
requestAnimationFrame
(
scrollHandler
);
});
//初始请求最新第一页数据
...
...
Please
register
or
login
to post a comment