不使用“all”的多种 css3 过渡类型
我正在尝试使用 CSS3 过渡来过渡比例和不透明度 - 我无法弄清楚如何在不使用 all
transition-function: all;
transition-duration: 1s;
transition-timing-function: ease-in;
作品的情况下过渡多个事物,就像:
transition: all 1s ease-in;
和
transition-function: opacity;
或
transition-function: scale;
但不
transition-function: scale, opacity;
请参阅此处的示例: http://jsfiddle.net/5PCGs/7/
任何帮助将不胜感激!谢谢 :) !
编辑:
我已经弄清楚它的transition-property
(感谢Simone),但现在它只是在Firefox中动画不透明,而不是两者 - http://jsfiddle.net/5PCGs/9 - 在 FF 和 Chrome 中并排比较
I'm trying to transition both the scale and the opacity using CSS3 transitions - I can't work out how to transition multiple things without using all
transition-function: all;
transition-duration: 1s;
transition-timing-function: ease-in;
works, as does:
transition: all 1s ease-in;
and
transition-function: opacity;
or
transition-function: scale;
but not
transition-function: scale, opacity;
See the example here: http://jsfiddle.net/5PCGs/7/
Any help would be really appreciated! Thanks :) !
Edit:
I have worked out it's transition-property
(thanks Simone), but now it's only animating opacity in Firefox, not both - http://jsfiddle.net/5PCGs/9 - compare this in FF and Chrome side-by-side
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
感谢 Boris Zbarsky 和 西蒙娜·维托里。
答案是使用
transition-property
并且不指定要在其中转换的所有内容,只需将transform
作为值之一放入,然后让差异类之间的转换会自动进行。编辑:不要添加您需要的任何前缀。以 Webkit 浏览器为例:
再次感谢!
Thanks to Boris Zbarsky and Simone Vittori.
The answer was to use
transition-property
and in not specify all the things you're transforming in there, just puttransform
in as one of the values, and let the differences in the transforms between the classes take care of itself.EDIT: Don't for get to add any prefixes you need to these. For Webkit browsers for example:
Thanks again!
尝试使用
transition-property
而不是transition-function
,它实际上不存在。 :)每个转换属性都接受逗号分隔的列表,允许定义多个转换。
Try to use
transition-property
instead oftransition-function
, that actually doesn't exist. :)Each of the transition properties accepts a comma-separated list, allowing multiple transitions to be defined.