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
Plain Diff
Browse Files
Authored by
Rock Zhang
9 years ago
Commit
028fb15f462a80b800712ceb92ff811c2c1a615e
2 parents
5c76a41a
c5e5304c
Merge branch 'develop' of git.dev.yoho.cn:web/yohobuy into develop
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
52 deletions
static/js/index/channel.js
static/js/index/channel.js
View file @
028fb15
...
...
@@ -10,23 +10,11 @@ var $searchBox = $('.search-box'),
$box
=
$
(
'.box'
),
$indexSearch
=
$
(
'.index-search'
),
$indexLogo
=
$
(
'.index-logo'
),
$channelLink
=
$
(
'.index-channel a'
),
$win
=
$
(
window
),
$doc
=
$
(
document
),
$appFloatLayer
=
$
(
'#float-layer-app'
);
$channelLink
=
$
(
'.index-channel a'
);
var
$search
=
$searchBox
.
children
(
'input[type="text"]'
),
$cancelSearch
=
$box
.
children
(
'.no-search'
),
$searchIcon
=
$searchBox
.
children
(
'.search-icon'
);
// variables for calculate the app download layer position
var
layerInit
=
false
,
windowViewHeight
=
0
,
layerContentHeight
=
$appFloatLayer
.
height
(),
layerPaddingTop
=
parseInt
(
$appFloatLayer
.
css
(
'padding-top'
)),
layerPaddingBottom
=
parseInt
(
$appFloatLayer
.
css
(
'padding-bottom'
)),
layerHeight
=
layerContentHeight
+
layerPaddingTop
+
layerPaddingBottom
,
layerNewPos
;
$cancelSearch
=
$box
.
children
(
'.no-search'
),
$searchIcon
=
$searchBox
.
children
(
'.search-icon'
);
require
(
'../common'
);
...
...
@@ -81,40 +69,3 @@ $channelLink.on('touchstart', function() {
borderColor
:
'#fff'
});
});
function
updateLayerPosition
()
{
var
winHeight
=
window
.
innerHeight
,
bodyHeight
=
$doc
.
height
(),
scrollTopPosition
=
$win
.
scrollTop
();
if
(
layerInit
)
{
//keyboard is shown
if
(
windowViewHeight
-
winHeight
>
200
)
{
if
(
scrollTopPosition
+
windowViewHeight
+
layerHeight
>=
bodyHeight
)
{
layerNewPos
=
0
;
}
else
{
layerNewPos
=
bodyHeight
-
windowViewHeight
-
scrollTopPosition
-
layerHeight
;
}
}
else
{
layerNewPos
=
bodyHeight
-
winHeight
-
scrollTopPosition
;
}
}
else
{
windowViewHeight
=
winHeight
;
layerNewPos
=
bodyHeight
-
winHeight
-
scrollTopPosition
+
layerHeight
;
layerInit
=
true
;
}
$appFloatLayer
.
css
({
position
:
'relative'
,
bottom
:
layerNewPos
+
'px'
});
}
$
(
window
).
scroll
(
function
()
{
window
.
requestAnimationFrame
(
updateLayerPosition
);
});
$doc
.
on
(
'ready'
,
updateLayerPosition
);
...
...
Please
register
or
login
to post a comment