html - 固定正文背景滚动与 iOS7 上的页面

标签 html css background-image

我使用了以下 CSS 来创建固定的正文背景。它适用于几乎所有浏览器,除了新的 iOS7。在后者上,背景不再固定。它随页面滚动。知道如何解决这个问题吗?

    body {
       background-color: #000; 
       background-image: url('../pics/backgrounds/blackWhite.jpg');
       background-repeat: no-repeat; 
       background-position: center;
       background-attachment: fixed;       
       webkit-background-size: cover;
       -moz-background-size: cover;
       -o-background-size: cover;
       background-size: cover;     
    } 

干杯

最佳答案

我会尝试找到一些引用,但移动浏览器强制使用 background: scroll,因为重新绘制太昂贵了。


引用:

CSS - Background images not displaying properly on mobile browsers

@PaulIrish还注意到这一点:

Fixed-backgrounds have huge repaint cost and decimate scrolling performance, which is, I believe, why it was disabled.

虽然有很多方法可以解决这个问题......但这不是一个快速的解决方案。 查看以下问题及其评论。

Android/Mobile Webkit CSS Background-Attachment:Fixed Not Working?

关于html - 固定正文背景滚动与 iOS7 上的页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19045364/

相关文章:

html - CSS3 交替表行不透明度影响文本和背景

javascript - 同一 LESS 文件中的多个 'for' 循环

javascript - 了解 CodePen 的 IDE 如何与 2d 射击游戏一起工作

javascript - jquery click 事件交换文本在第一次点击时不触发但在之后工作

css - 将背景图片链接到外部 URL 的最佳方式

css - 我怎样才能固定背景图像

javascript - 互联网浏览器 : Jquery unselects radio button after button is selected

html - 解决在小屏幕上重叠的视差滚动功能

javascript - 如何让多个按钮具有相同的 id 值,并且当单击任何按钮时应该弹出窗口?

jquery - 当浏览器窗口调整大小时,背景图像被覆盖而不是调整大小