所以我有这个HTML标记:
<div class="nav"></div>
<div class="content></div>
.nav{
background: url(...) no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
z-index: 10;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 80px;
}
.nav元素是固定的,背景图像和背景大小:封面集。它还具有比.content元素更高的z-index,因此当向下滚动页面时.content会隐藏在.nav后面。 此设置在浏览器中运行良好但在android / iOS上失败(.nav元素上的背景图像变得透明且不隐藏.content)。 有任何想法吗?
JSFiddle:https://jsfiddle.net/amp1Lyjq/1/
这部分修复了iOS动态滚动:
溢出-y:滚动; -webkit-overflow-scrolling:touch;