我需要在网站上显示多个固定的背景图像。它在台式机上效果很好,但在手机(Android / Chrome)上效果不佳。它显示为静态图像。在移动Firefox上,它似乎可以运行,但是可以跳过,这并不理想。
.bg {
background-color: green;
width: 100%;
height: 300px;
background-image: url(https://images.unsplash.com/photo-1554771129-5c8ecd59a14e?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1500&q=80);
background-size: cover;
background-attachment: fixed;
}
.bg-2 {
background-color: red;
width: 100%;
height: 300px;
background-image: url(https://images.unsplash.com/photo-1555137201-f717b8f9b99f?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1778&q=80);
background-size: cover;
background-attachment: fixed;
}
<div class="bg"></div>
<div class="bg-2"></div>