【问题标题】:Make parallax work on iOS without background-attachment:fixed在没有背景附件的情况下使视差在 iOS 上工作:已修复
【发布时间】:2021-01-07 16:12:44
【问题描述】:

有谁知道是否有合理的方法可以使这种视差背景滚动效果在 iOS 设备上工作?这是我正在处理的页面。 http://districtdentalontheouachita.com/new/

现在我要做的就是使用 background-attachment: fixed;

这是我的部分的 css

.section1 {
  width:100%;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background-size: cover;
  background-image: url("images/dental1.jpg");
  background-attachment:fixed;
}

客户端真的很想要这个效果,但我不能让它在iOS上工作......

【问题讨论】:

    标签: html css parallax web-development-server


    【解决方案1】:

    改用position: fixed,然后进行一些位置调整。

    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    

    这个,加上一些 z-index,可以在任何设备上产生效果。很遗憾 ios 不能与background-attachment: fixed 一起工作,但总有另一种方法。

    【讨论】:

    • 正如目前所写,您的答案尚不清楚。请edit 添加其他详细信息,以帮助其他人了解这如何解决所提出的问题。你可以找到更多关于如何写好答案的信息in the help center
    猜你喜欢
    • 2017-05-17
    • 1970-01-01
    • 2015-09-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-11-25
    • 2015-07-10
    • 2017-10-21
    相关资源
    最近更新 更多