【发布时间】:2014-06-11 08:48:27
【问题描述】:
我希望我的背景图片保持在同一位置。所以我利用了
background-attachment:fixed;
当我发现 iOS 显然不支持这个属性时,我决定在 DOM 中放置一个固定的背景 div。这实际上效果很好:
#background {
top:0;
left:0;
width:100%;
height:100%;
position:fixed;
background-position:50% 0%;
background-repeat:no-repeat;
background-attachment:fixed;
background-image:url("images/mark-bg.png");
}
乍一看,这在 iOS 中也很有效。但后来我意识到,如果不修复,Safari 会将 DIV 向上滚动到它本来可以滚动的位置。
现在我问自己»这到底是什么......?!«我的意思是......为什么iOS会滚动一个明确告知不要这样做的元素?
有什么智能解决方案吗?
编辑
我刚刚发现,不是元素自己移动,而是背景图像移动......
【问题讨论】:
标签: html ios css css-position fixed