背景图像未固定在移动设备上

时间:2020-12-27 17:28:08

标签: css shopify

我正在我的服装品牌店 (SHOPIFY) 上工作并添加了背景图片。 在桌面上它看起来很完美,正是我想要的。但在移动设备上,图像会失真,即使 CSS 代码位于 background-attachment: fixed; 上,图像也会随着产品和其他内容滚动。

网站:www.hyghassociation.org

这是我的完整代码:

    body,
html {
  background: url({{ 'background.jpg' | asset_url }});
    background-color: #000;
    -webkit-background-size: contain;
    -moz-background-size: contain;
    -o-background-size: contain;
    background-size: contain;
    background-position: center;
    background-attachment: fixed;
}
  @media only screen and (max-width: 749px) {
body {
    
    background: url({{ 'mobile_background.png' | asset_url }});
    -webkit-background-size: contain;
    -moz-background-size: contain;
    -o-background-size: contain;
    background-size: 100% 100%;
    background-position: center;
    background-attachment: fixed;

有人可以帮我解决这个问题吗?

0 个答案:

没有答案