...
|
...
|
@@ -18,6 +18,46 @@ 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(),
|
|
|
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'
|
|
|
});
|
|
|
};
|
|
|
})();
|
|
|
|
|
|
require('../common');
|
|
|
|
|
|
$search.on('focus', function() {
|
...
|
...
|
@@ -68,56 +108,11 @@ $channelLink.on('touchstart', function() { |
|
|
borderColor: '#fff'
|
|
|
});
|
|
|
});
|
|
|
var updateLayerPosition = (function() {
|
|
|
var init = false;
|
|
|
var windowViewHeight = 0;
|
|
|
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){
|
|
|
if (windowViewHeight - winHeight > 200){//keyboard is shown
|
|
|
newPosition = bodyHeight - winHeight - scrollTopPosition - (layerHeight + layerPaddingTop + layerPaddingBottom);
|
|
|
} else {
|
|
|
newPosition = bodyHeight - winHeight -scrollTopPosition;
|
|
|
}
|
|
|
|
|
|
if (scrollTopPosition + winHeight === bodyHeight) {
|
|
|
console.log('got end');
|
|
|
newPosition = 0;
|
|
|
}
|
|
|
}else{
|
|
|
windowViewHeight = winHeight;
|
|
|
newPosition = bodyHeight - winHeight - scrollTopPosition + layerHeight + layerPaddingTop + layerPaddingBottom;
|
|
|
init = true;
|
|
|
}
|
|
|
$appFloatLayer.css({
|
|
|
'position': 'relative',
|
|
|
'bottom': newPosition + 'px'
|
|
|
});
|
|
|
};
|
|
|
})();
|
|
|
|
|
|
$win.scroll(function() {
|
|
|
|
|
|
updateLayerPosition();
|
|
|
//clearTimeout($.data(this, 'scrollTimer'));
|
|
|
//$.data(this, 'scrollTimer', setTimeout(function() {
|
|
|
// updateLayerPosition();
|
|
|
//}, 2));
|
|
|
});
|
|
|
|
|
|
//$search.focusin(function() {
|
|
|
// $body.css('overflow','hidden');
|
|
|
//});
|
|
|
//
|
|
|
//$search.focusout(function() {
|
|
|
// $body.css('overflow','auto');
|
|
|
//});
|
|
|
|
|
|
$doc.on('ready', updateLayerPosition); |
...
|
...
|
|