背景附件:固定不工作在android / ios [英] background attachment: fixed not working on android/ios

查看:132
本文介绍了背景附件:固定不工作在android / ios的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的代码:

<div style="width: 100vw; height: 100vh; background-image: url(img/kid1/1.jpg); background-attachment: fixed; background-size: cover"></div>
<div style="width: 100vw; height: 100vh; background-image: url(img/kid1/2.jpg); background-attachment: fixed; background-size: cover"></div>

它适用于我的LAPTOP上的chrome,但没有应用程序chrome或任何网络浏览器在android / ios (智能设备)。事情是我试过这个代码在w3c练习mod和它的确在我的手机上工作,所以我的代码没有错,我的手机没有错,所以这里的问题是什么?我该如何解决这个问题?我是新手,所以这可能是一个noob问题,但这个错误真的很烦我...

It works fine with chrome on my LAPTOP but not with app chrome or any web browser on android/ios(smart device). The thing is I did try this code on w3c practice mod and it did work on my phone so my code is not wrong, my phone is not wrong so what is the problem here? And how can I fix this? I'm newbie so this might be a noob question but this error really pisses me off...

推荐答案

固定;

 .fixed { 
    background: url(img/kid1/1.jpg) no-repeat center center;
    background-attachment:fixed; 
    -webkit-background-size: cover;
    -moz-background-size: cover;
    -o-background-size: cover;
    background-size: cover;
    }

这篇关于背景附件:固定不工作在android / ios的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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