不使用“all”的多种 css3 过渡类型

发布于 2024-12-04 02:44:57 字数 822 浏览 0 评论 0原文

我正在尝试使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

韶华倾负 2024-12-11 02:44:57

感谢 Boris Zbarsky西蒙娜·维托里

答案是使用 transition-property 并且不指定要在其中转换的所有内容,只需将 transform 作为值之一放入,然后让差异类之间的转换会自动进行。

transition-property: transform,opacity;
transition-duration: 1s;
transition-timing-function: ease-in;

编辑:不要添加您需要的任何前缀。以 Webkit 浏览器为例:

-webkit-transition-property: -webkit-transform,opacity;
-webkit-transition-duration: 1s;
-webkit-transition-timing-function: ease-in;

再次感谢!

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 put transform in as one of the values, and let the differences in the transforms between the classes take care of itself.

transition-property: transform,opacity;
transition-duration: 1s;
transition-timing-function: ease-in;

EDIT: Don't for get to add any prefixes you need to these. For Webkit browsers for example:

-webkit-transition-property: -webkit-transform,opacity;
-webkit-transition-duration: 1s;
-webkit-transition-timing-function: ease-in;

Thanks again!

孤寂小茶 2024-12-11 02:44:57

尝试使用 transition-property 而不是 transition-function,它实际上不存在。 :)

每个转换属性都接受逗号分隔的列表,允许定义多个转换。

Try to use transition-property instead of transition-function, that actually doesn't exist. :)

Each of the transition properties accepts a comma-separated list, allowing multiple transitions to be defined.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文