Using background-attachment:fixed in safari on the ipad

前端 未结 7 484
误落风尘
误落风尘 2020-11-30 05:51

I\'m looking to recreate an effect similiar to the popular science app. Basically have one big background image and then have HTML/CSS layer on top of that. When the user sc

7条回答
  •  眼角桃花
    2020-11-30 06:50

    Expanding on Anlai's answer above, I found that solution was repeating my image as I was scrolling rather than keeping it fixed. If anyone else had this problem my CSS for the background_wrap ID is as follows:

    #background_wrap {
        z-index: -1;
        position: fixed;
        top: 0;
        left: 0;
        height: 100%;
        width: 100%;
        background-size: cover;
        background-image: url('../images/compressed/background-mobile.png');
        background-repeat: no-repeat;
        background-attachment: scroll;
    }
    

    Just changed the background size and background attachment to make the image static.

提交回复
热议问题