ios - body 上设置的背景图像被切断的问题 - iOS/Safari

标签 ios css iphone ipad

我在 <body> 上实现了背景图片以下网站的元素:http://www.bestdiscointown.co.uk/dev/ - 这是为了在用户滚动到页面底部时显示图像(以下屏幕截图显示这在 Firefox 中工作):

enter image description here

这是通过以下 CSS 实现的,并且在大多数网络浏览器中表现良好:

body {
    color: #fff;
    font-family: 'proxima_nova_ththin';
    background-image:  url("custom-assets/img/body_bg.jpg");  
    background-position: center top;
    background-repeat: no-repeat;
    background-attachment: fixed;
}

但是在 iOS 9.3.5 上的 Safari 中查看时出现以下问题并且背景图像被切断:

enter image description here

  1. 出现这个问题有什么原因吗,会不会是我设置了background-attachment: fixed;

  2. 可以在我的 CSS 中应用修复来解决这个问题吗?

最佳答案

众所周知,由于假定的性能问题,iOS 不会保持背景固定(通过 background-attachment: fixed)。您可以在此处阅读更多信息:https://stackoverflow.com/a/23420490/1887218

您可以做一个解决方法,将背景添加到全屏包装器,该包装器设置了 position: fixed。看这里:https://stackoverflow.com/a/12770538/1887218

关于ios - body 上设置的背景图像被切断的问题 - iOS/Safari,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39417352/

相关文章:

ios - Realm对象的过滤属性

iOS 从 YouTube 获取视频的 JSON 列表

android - NativeScript ListView 元素模板

javascript - 加载图像到 document.body 背景

iphone - 出于开发目的,如何使用 iOS 7 的 NSURLSession 及其委托(delegate)方法系列接受自签名 SSL 证书?

iphone - UI设备方向

android - 您可以在不编写任何 native 代码的情况下访问智能手机上的蓝牙吗?

ios - 在 CloudKit 中共享父记录时,子记录未显示在共享数据库中

css - 如何在 Bootstrap 包装器上居中图像

iphone - 为什么 Xcode 的 codeSense 功能有时只能工作?