固定主体背景与iOS7上的页面滚动 [英] Fixed body background scrolls with the page on iOS7

查看:126
本文介绍了固定主体背景与iOS7上的页面滚动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用下面的CSS来封住一个固定的背景。它几乎所有的浏览器,除了新的iOS7工作得很好。在后者背景不再是固定的。它与页面滚动。任何想法如何解决问题?

I've used the following CSS to ceate a fixed body background. It works well on almost all browsers except the new iOS7. On the latter the background is not fixed anymore. It scrolls with the page. Any idea how to fix the problem?

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;     
} 

CHEERS

推荐答案

我会尝试找到一些参考,但移动浏览器强制 background:scroll ,因为重画太贵了。

I'll try and find some reference, but mobile browsers force background: scroll because the repainting is too expensive.

参考:


CSS - 背景图片无法在移动浏览器上正常显示

@PaulIrish 也注意到: / p>

@PaulIrish also noted this:


固定背景有巨大的重新绘制成本和抽取滚动效果,我相信,为什么它被禁用。

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

虽然有这方面的方法,但它不是一个快速修复。
看看下面的问题和评论。

There are ways around this, though.. but it's not a quick fix. Have a look at the following question and it's comment.


Android / Mobile Webkit CSS背景附件:固定不工作?

这篇关于固定主体背景与iOS7上的页面滚动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆