...
|
...
|
@@ -18,45 +18,14 @@ var $search = $searchBox.children('input[type="text"]'), |
|
|
$cancelSearch = $box.children('.no-search'),
|
|
|
$searchIcon = $searchBox.children('.search-icon');
|
|
|
|
|
|
var updateLayerPosition = (function() {
|
|
|
var init = false,
|
|
|
windowViewHeight = 0;
|
|
|
|
|
|
|
|
|
return function() {
|
|
|
var winHeight = window.innerHeight,
|
|
|
bodyHeight = $doc.height(),
|
|
|
scrollTopPosition = $win.scrollTop(),
|
|
|
// 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,
|
|
|
newPosition;
|
|
|
|
|
|
if (init) {
|
|
|
|
|
|
//keyboard is shown
|
|
|
if (windowViewHeight - winHeight > 200) {
|
|
|
newPosition = bodyHeight - winHeight - scrollTopPosition - layerHeight;
|
|
|
} else {
|
|
|
newPosition = bodyHeight - winHeight - scrollTopPosition;
|
|
|
}
|
|
|
|
|
|
if (scrollTopPosition + winHeight === bodyHeight) {
|
|
|
newPosition = 0;
|
|
|
}
|
|
|
} else {
|
|
|
windowViewHeight = winHeight;
|
|
|
newPosition = bodyHeight - winHeight - scrollTopPosition + layerHeight;
|
|
|
init = true;
|
|
|
}
|
|
|
|
|
|
$appFloatLayer.css({
|
|
|
position: 'relative',
|
|
|
bottom: newPosition + 'px'
|
|
|
});
|
|
|
};
|
|
|
})();
|
|
|
layerNewPos;
|
|
|
|
|
|
require('../common');
|
|
|
|
...
|
...
|
@@ -110,9 +79,38 @@ $channelLink.on('touchstart', function() { |
|
|
});
|
|
|
|
|
|
|
|
|
$win.scroll(function() {
|
|
|
updateLayerPosition();
|
|
|
});
|
|
|
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); |
...
|
...
|
|