我的网站上有一个使用CSS背景图片的部分。该网站是here。您可以在“联系人”部分中查看我有固定背景图像的位置。这是图像的当前CSS:
#hs-contact-section {
color: #FFF;
background-image: url(../images/Chapel-interior.jpg);
background-size: cover;
background-attachment: fixed;
overflow: hidden;
}
有趣的是,如果我使用浏览器检查工具来模拟移动大小的窗口,则图像会被正确缩放。
但是,如果我在实际的移动设备上访问该网页,它看起来像这样:
我的CSS有问题吗?我尝试过在线搜索,但没有找到任何有效的解决方案。
答案 0 :(得分:1)
这很可能是因为您使用的视差效果“并不总是适用于移动设备。”
参考w3schools的说明 http://www.w3schools.com/howto/howto_css_parallax.asp
编辑:如果您想交换我们的图片或禁用效果,您可以在CSS中创建规则
//768px is generally the max mobile pixel width
@media screen and (max-width: 768px) {
#yourId {
element: attribute;
}
}