Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
YOHOBUYPC
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
2
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
梁志锋
9 years ago
Commit
ae626d5ce16f255cc8b1c2f1f78e208dab825626
1 parent
fe47f559
use requestAnimationFrame for window scroll event
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
61 additions
and
17 deletions
static/js/category/brand.js
static/js/guang/home.js
static/js/guang/list.js
static/js/home/maybe-like.js
static/js/index/channel.js
static/js/me/fav.js
static/js/me/my-guang.js
static/js/me/order.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 @
ae626d5
...
...
@@ -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,6 +62,10 @@ $(window).scroll(function() {
}
});
}
$
(
window
).
scroll
(
function
()
{
window
.
requestAnimationFrame
(
scrollHandler
);
});
function
changeBackground
()
{
...
...
static/js/guang/home.js
View file @
ae626d5
...
...
@@ -107,12 +107,16 @@ $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
]);
}
}
$
(
window
).
scroll
(
function
()
{
window
.
requestAnimationFrame
(
scrollHandler
);
});
$nav
.
on
(
'touchstart'
,
function
(
e
)
{
...
...
static/js/guang/list.js
View file @
ae626d5
...
...
@@ -40,8 +40,12 @@ if ($tag.length > 0) {
});
}
$
(
document
).
scroll
(
function
()
{
function
scrollHandler
()
{
if
(
$
(
window
).
scrollTop
()
+
winH
>=
$
(
document
).
height
()
-
0.25
*
$infos
.
height
())
{
loadMore
(
$infos
,
setting
);
}
}
$
(
window
).
scroll
(
function
()
{
window
.
requestAnimationFrame
(
scrollHandler
);
});
\ No newline at end of file
...
...
static/js/home/maybe-like.js
View file @
ae626d5
...
...
@@ -138,8 +138,12 @@ $('.maybe-like p').on('touchstart', function (e) {
});
//srcoll to load more
$
(
window
).
scroll
(
function
()
{
function
scrollHandler
()
{
if
(
$
(
window
).
scrollTop
()
+
winH
>=
$
(
document
).
height
()
-
50
)
{
search
();
}
}
$
(
window
).
scroll
(
function
()
{
window
.
requestAnimationFrame
(
scrollHandler
);
});
\ No newline at end of file
...
...
static/js/index/channel.js
View file @
ae626d5
...
...
@@ -91,9 +91,8 @@ var updateLayerPosition = (function() {
};
})();
$win
.
scroll
(
function
()
{
updateLayerPosition
();
$
(
window
).
scroll
(
function
()
{
window
.
requestAnimationFrame
(
updateLayerPosition
);
});
$doc
.
on
(
'ready'
,
updateLayerPosition
);
...
...
static/js/me/fav.js
View file @
ae626d5
...
...
@@ -206,9 +206,8 @@ favContentHammer.on('tap', function(e) {
});
});
// 上拉加载更多
$
(
document
).
scroll
(
function
()
{
function
scrollHandler
()
{
if
(
$
(
window
).
scrollTop
()
+
winH
>=
$
(
document
).
height
()
-
footerH
)
{
if
(
brandTab
)
{
...
...
@@ -231,4 +230,8 @@ $(document).scroll(function() {
}
}
}
}
$
(
window
).
scroll
(
function
()
{
window
.
requestAnimationFrame
(
scrollHandler
);
});
\ No newline at end of file
...
...
static/js/me/my-guang.js
View file @
ae626d5
...
...
@@ -18,13 +18,17 @@ 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
);
$
(
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 @
ae626d5
...
...
@@ -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,10 @@ $(window).scroll(function() {
noLoadingMask
:
true
});
}
}
$
(
window
).
scroll
(
function
()
{
window
.
requestAnimationFrame
(
scrollHandler
);
});
//初始化请求第一页数据
...
...
static/js/product/list.js
View file @
ae626d5
...
...
@@ -362,13 +362,17 @@ $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
();
}
}
$
(
window
).
scroll
(
function
()
{
window
.
requestAnimationFrame
(
scrollHandler
);
});
if
(
$brandHeader
.
length
>
0
)
{
...
...
static/js/product/newsale/discount.js
View file @
ae626d5
...
...
@@ -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,10 @@ $(window).scroll(function() {
search
();
}
}
}
$
(
window
).
scroll
(
function
()
{
window
.
requestAnimationFrame
(
scrollHandler
);
});
//初始请求最新第一页数据
...
...
static/js/product/newsale/hot-rank.js
View file @
ae626d5
...
...
@@ -53,7 +53,8 @@ function hotrank(page, sort, tabId, notab) {
});
}
$
(
window
).
scroll
(
function
()
{
function
scrollHandler
()
{
if
(
page
===
2
)
{
return
;
}
...
...
@@ -63,8 +64,12 @@ $(window).scroll(function () {
page
=
2
;
notab
=
1
;
hotrank
(
page
,
sort
,
id
,
notab
);
}
$
(
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 @
ae626d5
...
...
@@ -359,7 +359,8 @@ $listNav.on('touchend touchcancel', function(e) {
e
.
stopPropagation
();
});
$
(
window
).
scroll
(
function
()
{
function
scrollHandler
()
{
//当scroll到1/4$goodsContainer高度后继续请求下一页数据
if
(
$
(
window
).
scrollTop
()
+
winH
>
...
...
@@ -368,6 +369,10 @@ $(window).scroll(function() {
search
();
}
}
}
$
(
window
).
scroll
(
function
()
{
window
.
requestAnimationFrame
(
scrollHandler
);
});
//初始请求最新第一页数据
...
...
Please
register
or
login
to post a comment