【问题标题】:CSS/Chrome white blocks appear when scrolling滚动时出现 CSS/Chrome 白块
【发布时间】:2019-07-31 21:06:18
【问题描述】:

我最近遇到了一个问题,每当我滚动时,网站顶部/底部都会出现白色块。白色块是body background的一部分,因为改变body backgroundcolor 会使块也改变颜色。

我已经尝试过为身体设置不透明度,但这根本没有效果......有什么想法可能会出错吗?或者我只是有太多的过渡/淡入淡出内容,以至于渲染不能顺利进行?

这是问题的屏幕截图,很难捕捉到 ss,因为它只在滚动时发生半秒。该块由红色箭头指示。

编辑:

我实际上会发布我的 css 文件的一部分,也许这会照亮任何线索:

html, body {
    height: 100%;
    position: static;
    overflow-x:hidden;
    -webkit-transform: translate3d(0, 0, 0);
    background-color: rgba(255, 255, 255, 0.06);
    transform: translate3d(0,0,0);
}
.heroEffects .bg {
    -webkit-backface-visibility: hidden;
    transform: scale(1);
    -webkit-box-shadow: inset 4px 1px 77px 40px rgba(0,0,0,0.78);
    -moz-box-shadow: inset 4px 1px 77px 40px rgba(0,0,0,0.78);
    box-shadow: inset 4px 1px 77px 40px rgba(0,0,0,0.78);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    -webkit-transition: opacity 1s ease-in-out;
    -moz-transition: opacity 1s ease-in-out;
    -o-transition: opacity 1s ease-in-out;
    transition: opacity 1s ease-in-out;
    transform: translate3d(0,0,0);
}
.bgimg {
    -webkit-backface-visibility: hidden;
    -webkit-background-size: cover;
    -moz-background-size: cover;
    -o-background-size: cover;
    background-size: cover;
    position: absolute;
    background-repeat: no-repeat;
    background-position: center center;
    transform: scale(1);
    overflow: hidden;
    -webkit-box-shadow: inset 0px 0px 97px 69px rgba(0,0,0,0.85);
    -moz-box-shadow: inset 0px 0px 97px 69px rgba(0,0,0,0.85);
    box-shadow: inset 0px 0px 97px 69px rgba(0,0,0,0.85);
    top: 0;
    left: 0;
    height: 100%;
    width: 100%;
    background-image: url("../img/gallery/slonecz.jpg");
    animation-name: backgroundchangeFadeInOut;
    animation-timing-function: ease-in-out;
    animation-iteration-count: infinite;
    animation-duration: 15s;
    animation-delay: 5s;
    -webkit-animation-delay: 5s
    -webkit-animation-name: backgroundchangeFadeInOut;
    -webkit-animation-timing-function: ease-in-out;
    -webkit-animation-iteration-count: infinite;
    -webkit-animation-duration: 15s;
    transform: translate3d(0,0,0);
}

@keyframes backgroundchangeFadeInOut {
    0% {
       background-image: url("../img/gallery/slonecz.jpg");
    }
    15% {
       background-image: url("../img/gallery/slonecz.jpg");
    }
    30% {
       background-image: url("../img/gallery/slonecz.jpg");
    }
    42% {
       background-image: url("../img/gallery/slonecz.jpg");
    }
    50% {
       background-image: url("../img/gallery/motyl.jpg");
    }
    68% {
       background-image: url("../img/gallery/motyl.jpg");
    }
    80% {
       background-image: url("../img/gallery/motyl.jpg");
    }
    95% {
       background-image: url("../img/gallery/motyl.jpg");
    }
    100% {
       background-image: url("../img/gallery/slonecz.jpg");
   }
}

.heroEffects .shade {
    opacity: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 3;
    height: 100vh;
    position: fixed;
    width: 100%;
}

这里是 Vimeo vid,屏幕录像机似乎在最上面,您实际上可以看到当带有该站点的浏览器在后台时会发生什么...https://vimeo.com/198493320

【问题讨论】:

  • 我以前注意到过这种行为。我认为这是性能, translateZ(0) hack 可能会有所帮助。检查this question 是否有同样的问题。
  • 嗨,阿尔瓦罗,感谢您的回复!不幸的是,这在我的情况下不起作用......仍然是同样的问题,我什至会说我实际上可以看到更多的空白,但这可能不是真的,呵呵。实际上可能提供另一个线索的是,每当我在网站顶部打开另一个窗口(例如括号)时,它也会不时自动显示空白。
  • 你解决过这个问题吗?
  • @avoliva 实际上是的 - 更改图像分辨率以便浏览器不必将关键帧应用于大图像使其工作得更轻微

标签: css background css-transitions block


【解决方案1】:

在我的情况下,在身体上使用overflow: hidden;

body {
   overflow: hidden;
}

【讨论】:

    【解决方案2】:

    这适用于我的 chrome 76.0.3809.87

    overflow: auto;
    

    希望对你有帮助。

    【讨论】:

    • 有很多 CSS 选择器有问题。你把 overflow: auto; 放在哪里了?
    猜你喜欢
    • 1970-01-01
    • 2015-03-12
    • 1970-01-01
    • 2012-07-25
    • 2013-09-10
    • 1970-01-01
    • 1970-01-01
    • 2020-04-04
    • 2015-07-03
    相关资源
    最近更新 更多