[英]CSS Parallax works in Chrome, but not Firefox?
As far as I'm aware, as documented by Keith Clark's blog post on pure CSS parallax here , CSS parallax should work in all major browsers except IE, since Microsoft has not as of yet implemented support for transform-style:preserve-3d
. 据我所知,通过纯CSS视差基思·克拉克的博客文章作为记录在这里 ,CSS视差应该在除了IE以外的主要浏览器,因为微软并没有为尚未实现支持的
transform-style:preserve-3d
。
Yet, my own basic implementation of this effect, demonstrated here in this jsFiddle , works in Chrome 39, but does not Firefox 34. The latter does not seem to even be applying the 但是,此效果的我自己的基本实现已在jsFiddle中进行了演示,可在Chrome 39中使用,但不适用于Firefox34。后者似乎甚至没有应用
.back {
transform:translateZ(-2px);
}
style. 样式。 What is the reason for this?
这是什么原因呢? Is there any fix?
有没有解决办法? I've attempted to disable and enable various properties on each element to no success.
我试图禁用和启用每个元素的各种属性,但均未成功。 Yet, I'm at a loss to explain how Keith Clark's implementation here works, yet mine does not.
但是,我很茫然地解释了Keith Clark的实现在这里如何工作,而我的却没有。
there are a couple of problems in the HTML that are preventing Firefox from working. HTML中存在一些阻止Firefox运行的问题。 The first is that
.container
with overflow:hidden
is a direct parent of your parallax items. 首先是那个带有
overflow:hidden
.container
是您的视差项的直接父项。 Your body tag (which already has the specific parallax overflow settings overflow-x: hidden; overflow-y: auto;
) needs to be the direct parent of your parallax-group. 您的body标签(已经具有特定的视差溢出设置
overflow-x: hidden; overflow-y: auto;
)必须是您的视差组的直接父对象。
Second, your non-parallax items (the lorem ipsum paragraphs) also need position: relative;
其次,您的非视差项目(lorem ipsum段落)也需要
position: relative;
and a z-index so you can control the layering. 和Z索引,以便您可以控制分层。 I tried it in FF on your JSFiddle page and it works.
我在您的JSFiddle页面上的FF中尝试了它,并且有效。 I was trying to solve the same problem myself because the non-direct wrapper causes different problems in Chrome.
我自己尝试解决相同的问题,因为非直接包装会在Chrome中引起不同的问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.