html - 使视差在没有背景附件的 iOS 上工作:已修复
问题描述
有谁知道是否有合理的方法可以使这种视差背景滚动效果在 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 上工作......
解决方案
改为使用position: fixed
,然后进行一些位置调整。
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
这与一些 z-index 一起可以在任何设备上产生效果。不幸的是 ios 无法使用,background-attachment: fixed
但总有另一种方法。
推荐阅读
- java - 如何使用匿名身份验证将数据保存到 Android 中的 Firestore 数据库?
- r - 如何重塑数据框并进行计数
- .net - 使用源链接的最佳实践
- azure - 如何修复“目标 URL,它被视为启用 Microsoft Azure 身份验证的回复 URL,丢失”
- javascript - 为什么 JavaScrips 仅在加载页面后才有效?
- android - 如何为右下角的 CardView 实现不同的角半径应该比其他角有更大的半径
- python - 在共指解析中获取 stanfordNLP 输出中的字符位置
- c# - 从左到右编号坐标和拉绳
- css - 如何使用 React 打印页眉和页脚
- c - 仅写入动态分配的内存块的一部分是否会设置整个块的有效类型?