后台附件:修复了在 android/mobile 上不工作的问题 [英] Background-attachment: fixed not working on android/mobile

查看:28
本文介绍了后台附件:修复了在 android/mobile 上不工作的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发 Cordova 应用程序,并试图获得固定的背景.不幸的是,它似乎不起作用,并且每当我向下滚动背景时,它就会离开页面顶部.这是我用来执行此操作的 CSS(我已经尝试了其他几种方法):

html {宽度:100%;高度:100%;背景色:#000000;背景图片:url('../img/bg_reader.jpg');/* 背景重复:不重复;背景附件:固定;背景位置:中心;*/背景尺寸:100% 100%;}

无论如何,当我向下滚动时,背景会从屏幕顶部滚动,就好像没有设置固定属性一样.

解决方案

你试过了吗?

<前>html,正文{高度:100%;}html {溢出-y:隐藏;}身体 {溢出-y:滚动;背景色:#000000;背景图片:url('../img/bg_reader.jpg');}

I'm developing a cordova app and I'm trying to get a fixed background. Unfortunately, it doesn't seem to be working, and anytime I scroll down the background simply goes off the top of the page. Here's the CSS I'm using to do this (and I've tried it several other ways):

html {
    width:100%;
    height: 100%;
    background-color:#000000;
    background-image:url('../img/bg_reader.jpg');
    /*background-repeat:no-repeat;
    background-attachment: fixed;
    background-position: center;*/
    background-size: 100% 100%;
}

No matter what, the background scrolls off the top of the screen when I scroll down as if the fixed property weren't set.

解决方案

Have you tried this?


    html, body {
        height: 100%;
    }
    html {
        overflow-y: hidden;
    }
    body {
        overflow-y: scroll;
        background-color:#000000;
        background-image:url('../img/bg_reader.jpg');
    }

这篇关于后台附件:修复了在 android/mobile 上不工作的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆