模仿IE中的CSS3过渡?

发布于 2024-11-17 22:01:53 字数 451 浏览 4 评论 0原文

我使用规则组合来以尽可能跨浏览器兼容的方式实现 CSS3 transition 规则:我正在使用 transition-webkit -transition-moz-transition-o-transition

任何版本的 Internet Explorer 是否都有类似的 -ms-transition 属性?是否有适用于旧版本 IE 的专有过滤器,类似于以下规则在 IE 6-8 中的不透明度工作原理?

/* IE 8 */ 
-ms-filter: "progid:DXImageTransform.Microsoft. Alpha(Opacity=50)"; 
/* IE 5-7 */ 
filter: alpha(opacity=50);

I'm using a combination of rules to achieve the CSS3 transition rule in as cross-browser compatible a way as possible: I'm using transition, -webkit-transition, -moz-transition, and -o-transition.

Is there a similar -ms-transition property for any version of Internet Explorer? Is there a proprietary filter for older versions of IE, similar to how the following rules work for opacity in IE 6-8?

/* IE 8 */ 
-ms-filter: "progid:DXImageTransform.Microsoft. Alpha(Opacity=50)"; 
/* IE 5-7 */ 
filter: alpha(opacity=50);

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(5

诺曦 2024-11-24 22:01:53

旧版本的 IE 中没有任何过渡效果。

据我所知,获得接近它的唯一方法是使用 JQuery 的 fadeIn()fadeOut() 方法,它们实际上适用于所有版本的 IE。

然而,我应该提醒大家,它们仍然与 IE 众所周知的糟糕的不透明度处理相冲突。当与 IE6-8 一起使用时,JQuery 的淡入淡出效果可能会出现一些奇怪的故障,特别是当您淡入包含图形的块时。

如果您决定尝试一下,代码非常简单。只需将 JQuery 包含在标头中,然后:

$('#myelement').fadeIn();

在适当的位置。

有关详细信息,请参阅 JQuery FadeIn 手册页

当然,这将代替任何 CSS 过渡效果;这一切都是通过 Javascript 完成的,您可能需要放弃 CSS3 过渡,否则它会与 JQuery 效果发生冲突。但如果你想让它与 IE 一起工作,这就是你要付出的代价。

正如我所说,要小心故障。测试一下,看看它是否适合您。

这是唯一的方法,所以如果您确实需要 IE 中的过渡效果,那么您就需要这样做,但要准备好接受它可能看起来不太好。

其他 Javascript 库(例如 Mootools 或 Dojo)可能具有类似的效果,您也可以尝试,但我想如果他们确实有它,他们也会遇到同样的问题。

There isn't any kind of transition effect in older versions of IE.

The only way that I know of to get anything close to it is to use JQuery's fadeIn() and fadeOut() methods, which do actually work in all versions of IE.

However, I should caution that they still fall foul of IE's notoriously poor opacity handling. JQuery's fade effects can have some weird glitches when used with IE6-8, especially if you're fading a block which contains graphics.

If you decide to try it, the code is dead simple. Simply include JQuery in your headers, and then:

$('#myelement').fadeIn();

in the appropriate place.

See the JQuery FadeIn manual page for further information.

Of course, this would be instead of any CSS transition effect; it's all done through Javascript, and you'd probably need to throw away your CSS3 transitions, or it'll clash with the JQuery effects. But if you want it to work with IE, that's the price you'll pay.

And as I say, watch out for the glitches. Test it, and see how it looks for you.

It's the only way to do it, so if you really need a transition effect in IE, that's what you'll need to do, but be prepared to accept that it may not look all that good.

Other Javascript libraries such as Mootools or Dojo may have similar effects which you could also try, but I would imagine if they do have it, they'd suffer from the same issues.

扶醉桌前 2024-11-24 22:01:53

我在研究同一问题时遇到了这个问题: http://www. useragentman.com/blog/csssandpaper-a-css3-javascript-library/

我还发现了一个名为 move.js 的库,它可以与 CSS3 过渡一起使用:https://github.com/visionmedia/move.js

希望这会有所帮助。

I ran into this while researching the same question: http://www.useragentman.com/blog/csssandpaper-a-css3-javascript-library/

I also found a library called move.js, which can be used alongside CSS3 transitions: https://github.com/visionmedia/move.js

Hope this helps.

压抑⊿情绪 2024-11-24 22:01:53

IE10 将具有 CSS3 过渡,在此之前您将必须使用 javascript。

IE10 will have CSS3 transitions, until then you will have to use javascript.

浪漫人生路 2024-11-24 22:01:53

CSS3 转换规则和其他 CSS3 规则在 IE 10 中运行良好。不再需要前缀“-ms-”,但仍会被识别。为了确保将来的兼容性,使用具有转换属性的 Microsoft 供应商前缀的应用程序应进行相应更新。因此,更新您的 CSS 代码,添加带有规则的行,不带任何前缀。

CSS3 transition rule and other CSS3 rules works fine in IE 10. Prefix "-ms-" is no longer required, but will still be recognized. To ensure compatibility in the future, applications using the Microsoft vendor prefix with transition properties should be updated accordingly. So, update your CSS code, add line with rule, without any prefix.

只为守护你 2024-11-24 22:01:53

对于 IE < 10 你可以尝试其中之一
我没有亲自尝试过,但它们看起来很有希望
http://www.useragentman.com/blog/csssandpaper-a- css3-javascript-library/
http://addyosmani.com/blog/css3transitions-jquery/(断开的链接)

for IE < 10 you can try either one of those
I have not tried personally but they look promising
http://www.useragentman.com/blog/csssandpaper-a-css3-javascript-library/ or
http://addyosmani.com/blog/css3transitions-jquery/ (broken link)

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