如何防止背景附件:固定;从我的网站滞后? [英] How can I prevent background-attachment:fixed; from lagging my website?
问题描述
我使用background-attachment:fixed;在我的网站,但它是导致Chrome延迟一些用户。有没有办法有同样的效果,而不会导致滞后?自从我删除它,我已经停止了,但我更喜欢看我的网站。
I was using background-attachment:fixed; on my website but it was causing Chrome to lag for some users. Is there a way to have the same effect without causing lag? Lag has stopped since I removed it but I much preferred the look for my site.
推荐答案
实际上是已知错误自2011年以来, background-attachment:fixed
It is actually a known bug since 2011, the background-attachment:fixed
rule causes the browser to repaint the background on every scroll, which is an issue on large screens and Retina displays.
有一个解决方法,它可以帮助浏览器重新绘制每个滚动的背景,这是大屏幕和Retina显示屏上的问题。将此规则添加到css样式表中:
There is a workaround, add this rule to your css stylesheet:
html{
-webkit-transform: translate3d(0,0,0);
}
这篇关于如何防止背景附件:固定;从我的网站滞后?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!