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
f1067aa35ee4be51f0a7d7ffb079243fc36459b3
1 parent
ae626d5c
use requestAnimationFrame for window scroll event
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
29 additions
and
25 deletions
static/js/home/maybe-like.js
static/js/index/channel.js
static/js/product/newsale/discount.js
static/js/product/newsale/hot-rank.js
static/js/home/maybe-like.js
View file @
f1067aa
...
...
@@ -133,7 +133,7 @@ function search() {
});
}
$
(
'.maybe-like p'
).
on
(
'touchstart'
,
function
(
e
)
{
$
(
'.maybe-like p'
).
on
(
'touchstart'
,
function
(
e
)
{
search
();
});
...
...
static/js/index/channel.js
View file @
f1067aa
...
...
@@ -68,28 +68,33 @@ $channelLink.on('touchstart', function() {
borderColor
:
'#fff'
});
});
var
updateLayerPosition
=
(
function
()
{
var
init
=
false
;
return
function
()
{
var
winHeight
=
window
.
innerHeight
;
var
bodyHeight
=
$doc
.
height
();
var
scrollTopPosition
=
$win
.
scrollTop
();
var
layerHeight
=
$appFloatLayer
.
height
();
var
layerPaddingTop
=
parseInt
(
$appFloatLayer
.
css
(
'padding-top'
));
var
layerPaddingBottom
=
parseInt
(
$appFloatLayer
.
css
(
'padding-bottom'
));
var
newPosition
;
if
(
init
){
newPosition
=
bodyHeight
-
winHeight
-
scrollTopPosition
;
}
else
{
init
=
true
;
newPosition
=
bodyHeight
-
winHeight
-
scrollTopPosition
+
layerHeight
+
layerPaddingTop
+
layerPaddingBottom
;
}
$appFloatLayer
.
css
({
'position'
:
'relative'
,
'bottom'
:
newPosition
+
'px'
});
};
})();
function
updateLayerPosition
()
{
var
init
=
false
;
return
function
()
{
var
winHeight
=
window
.
innerHeight
;
var
bodyHeight
=
$doc
.
height
();
var
scrollTopPosition
=
$win
.
scrollTop
();
var
layerHeight
=
$appFloatLayer
.
height
();
var
layerPaddingTop
=
parseInt
(
$appFloatLayer
.
css
(
'padding-top'
));
var
layerPaddingBottom
=
parseInt
(
$appFloatLayer
.
css
(
'padding-bottom'
));
var
newPosition
;
if
(
init
)
{
newPosition
=
bodyHeight
-
winHeight
-
scrollTopPosition
;
}
else
{
init
=
true
;
newPosition
=
bodyHeight
-
winHeight
-
scrollTopPosition
+
layerHeight
+
layerPaddingTop
+
layerPaddingBottom
;
}
$appFloatLayer
.
css
({
position
:
'relative'
,
bottom
:
newPosition
+
'px'
});
};
}
$
(
window
).
scroll
(
function
()
{
window
.
requestAnimationFrame
(
updateLayerPosition
);
...
...
static/js/product/newsale/discount.js
View file @
f1067aa
...
...
@@ -347,7 +347,6 @@ $listNav.on('touchend touchcancel', function(e) {
search
();
}
}
e
.
stopPropagation
();
});
...
...
static/js/product/newsale/hot-rank.js
View file @
f1067aa
...
...
@@ -72,7 +72,7 @@ $(window).scroll(function() {
hotrank
(
page
,
sort
,
id
,
notab
);
hotnav
=
new
Hammer
(
document
.
getElementById
(
'hotRank'
));
hotnav
.
on
(
'tap'
,
function
(
e
)
{
hotnav
.
on
(
'tap'
,
function
(
e
)
{
var
ev
=
ev
||
window
.
event
;
var
target
=
ev
.
target
||
ev
.
srcElement
;
...
...
Please
register
or
login
to post a comment