是否有针对 Opera 可见性转换错误的 CSS 解决方法?
这是一个开始的小提琴: http://jsfiddle.net/kizu/A7QX9/
问题:在 Opera 中,当您为 visibility
属性(通常与 opacity
一起)设置过渡动画时,它的动画效果不正确:visibility
始终更改为过渡结束,因此当块出现时,它不会顺利出现。
那么,问题是:是否有任何仅 CSS 的解决方法来解决这个 Opera 的错误?
Here is a fiddle for start: http://jsfiddle.net/kizu/A7QX9/
The problem: in Opera when you animate the transition for visibility
property (usually along with the opacity
) it's not animated properly: the visibility
is changed always at the end of transition, so when the block is appearing it's not appearing smoothly.
So, the question: is there any CSS-only workaround for this Opera's bug?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在我提出问题并思考一段时间后,我自己找到了答案。
并想出了一个解决方案。
因此,逐步进行:
不透明度
和可见性
时,当过渡处于运行状态时,块将保持visibility:hidden
状态。因此,您不需要在此处使用过渡来实现可见性。这是我用这个解决方案制作的小提琴: http://jsfiddle.net/kizu/A7QX9/ 1/
After I formulated the question and thought for a while, I've found the answer myself.
And came up with a solution.
So, going step-by-step:
opacity
andvisibility
with a transition, the block stays withvisibility: hidden
while the transition is in the run. So, you don't need to use transition forvisibility
here.visibility
at the end of the transition, so you need the transition here apparently.opacity
and in the selector where it's shown, you don't need the transition.Here is a fiddle I've made with this solution: http://jsfiddle.net/kizu/A7QX9/1/
Opera 中当前过渡的实现基于旧版规范,该版本规定转换可见性“1 是“可见”,所有其他值都是“隐藏”。”
因此,如果您尝试从“隐藏”转换为“可见”,那么您将看不到该元素,直到表示转换的底层 0-1 范围达到值 1。
同时,如果您从“可见”过渡到“隐藏”,则一旦开始过渡,元素就会消失,因为值将小于 1。
您期望的行为在规范的“草案”版本中指定,其中表示“0 是“隐藏的”,所有其他值都是“可见的”。”
不过好消息是 - Opera 12 将修复此错误。预计很快就会在 Desktop Team 博客 上看到带有修复程序的测试版本。
Current implementation of transitions in Opera is based on an older version of the spec saying that for transitioning visibility "1 is "visible" and all other values are "hidden"."
So if you try transitioning from "hidden" to "visible" then you won't see the element until underlying 0-1 range representing transition reaches value 1.
At the same time, if you are transitioning from "visible" to "hidden" then element will disappear as soon as transition has started as value will be <1.
The behavior that you expect is specified in the "draft" version of the spec which says that "0 is "hidden" and all other values are "visible".".
Good news though - Opera 12 will include fix for this bug. Expect to see testing build with a fix on Desktop Team blog soon.