简体   繁体   English

使用stellar.js在移动设备上无法正确显示背景图像

[英]background-image is not showing correctly on mobile devices using stellar.js

Hi guys I'm using stellar.js and it is working quiet well for desktop devices. 嗨,大家好,我使用的是stellar.js,它对于台式机设备而言运行正常。 But on mobile devices the background-image will be displayed only a part of it. 但是在移动设备上,背景图像将仅显示其中一部分。 It is not showing the whole image but the left corner of the image. 它不是显示整个图像,而是显示图像的左上角。 The problem must be the css code. 问题必须是CSS代码。 But I don't see it. 但是我看不到。 Thanks for the help guys! 感谢您的帮助!

My css looks like: 我的CSS看起来像:

.intro-section {
    padding: 150px 0px;
    text-align: center;
    background-attachment: fixed;
    width:100%;
    height:100%;
    position: relative;
    background-position: center center;
    background-size: cover;
    background-image: url(../images/frederick_meseck_wood_logo.png);
    background-repeat: no-repeat;
}

@media(min-width:768px) {
    .intro-section {
        min-height: 100%;
    }
}

Try this in your media query: 在媒体查询中尝试以下操作:

@media(min-width:768px) {
    .intro-section {
        background-attachment: inherit !important;
        background-size: 100% 100%;
        background-repeat: no-repeat;
    }
}

The first background-size parameter is the width, you can increase this value when going to smaller devices (I recommend this) 第一个background-size参数是width,您可以在使用较小的设备时增加此值(我建议这样做)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM