我在iOS上的Google App中遇到同样的问题。 100%高度的网站,上面和下面都有绝对定位的元素。
原因
正确地检测到谷歌应用程序的视口的高度,但谷歌应用程序投入的默认顶部他的地址栏上的网站,并在底部的一些其他酒吧如逢过的网站。因此,属于Google应用的这些元素就像您网站上绝对定位的元素。
但是,当您打开网站时,Google App会“向下滚动”一些网站,以便网站顶部出现在地址栏下方(否则网站的顶部将会隐藏。整个网站如30px,其中100%高度的网站使其看起来像视口为100%+ 30px。当您滚动一下时,顶部的地址栏和底部的其他栏消失,网站将会完美展现。
解决方法
一个指令添加到重新调整应用程序的高度与viewpo的innerheight身体RT。在我的情况下工作。
<body force-full-height>
<!-- Your content -->
</body>
...
(function() {
var app = angular.module('my.directives', []);
app.directive('forceFullHeight', forceFullHeight);
forceFullHeight.$inject = [
'$window',
'$rootScope'
];
function forceFullHeight($window, $rootScope) {
return {
restrict: 'A',
link: function link(scope, element, attrs) {
function onResize() {
element.css('height', $window.innerHeight + 'px');
};
function cleanUp() {
angular.element($window).off('resize', onResize);
}
angular.element($window).on('resize', onResize);
scope.$on('$destroy', cleanUp);
scope.$on('$viewContentLoaded', onResize());
}
};
}
})();