jQuery的fadeIn()和fadeOut()不能与IE 8一起使用吗? [英] Does jQuery's fadeIn() and fadeOut() not work with IE 8?

查看:387
本文介绍了jQuery的fadeIn()和fadeOut()不能与IE 8一起使用吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个fadeIn和fadeOut内联元素的页面,jQuery不起作用。然后,当我将开发者工具更改为使用IE 7的浏览器模式时,则显示fadeIn()和fadeOut()效果。

I have a page that fadeIn and fadeOut an inline element and jQuery doesn't work. And then when I change the Developer Tools to use Browser Mode of IE 7, then the fadeIn() and fadeOut() effect is showing.

推荐答案

IE有一个称为hasLayout的实现细节,遗憾的是,它经常泄漏API抽象并且必须正面处理......这就是你今天面临的战斗:内联元素通常不会有布局,因此不适用于过滤器...这是jQuery用来模拟IE上的不透明度。

IE has an implementation detail known as "hasLayout" that, sadly, often leaks past the API abstraction and must be dealt with head-on... This is the battle you face today: inline elements generally won't have "layout" and thus won't work with "filters"... which are what jQuery uses to simulate opacity on IE.

这在IE8中并不新鲜,通常你根本不必担心它,因为它正是这种特定于浏览器的疯狂jQuery意图事实上,这就是为什么我不打算详细讨论hasLayout和过滤器实际意味着什么 - 你可能不关心,也不应该(但是,如果你'重新感兴趣,google it ...)

This isn't new in IE8, and normally you wouldn't have to worry about it at all since it's exactly this sort of browser-specific madness that jQuery is intended to paper over... Indeed, that's why I'm not bothering to go into detail on what "hasLayout" and "filters" actually mean - you probably don't care, and shouldn't have to (but, if you're interested, google it...)

问题是,jQuery使用的黑客强制布局(所以过滤器工作(因此它可以模拟不透明度) IE没有实现它)))...它不适用于IE8。 不是很好,是吗?他们修复了 display:inline 元素表现为 display:inline-block 元素的错误,但忽略了实现该功能人们正在使用他们的bug来支持...

Problem is, the hack that jQuery uses under the hood to force layout (so filters work (so it can simulate opacity (since IE doesn't implement it)))... it doesn't work on IE8. Ain't that just great, eh? They fixed the bug whereby display: inline elements behaved as display: inline-block elements, but neglected to implement the feature that folks were using their bug to hack in support for...

嗯,没什么'你能做到的。给团队IE写一个讨厌的电子邮件可能会让你觉得好一点,但是他们很难在IE9上工作,这应该(敲木头......)解决大多数这些问题。与此同时,你只需要手动完成IE 使用所做的事情(有点,有点,而且肯定是错误的):强制内联元素进入内联块模式:

Well, nothin' you can do about that. Writing a nasty email to Team IE might make you feel a bit better, but they're hard at work on IE9, which should (knock on wood...) fix most of these problems. In the meantime, you'll just have to do manually what IE used to do (kinda, sorta, and most certainly incorrectly) all by itself: force the inline element into inline-block mode:

$("myInlineElement").css({display: 'inline-block'}).faceOut();

...或更好,将它放在仅IE8的样式表中 ...

...or better yet, put it in an IE8-only stylesheet...

这篇关于jQuery的fadeIn()和fadeOut()不能与IE 8一起使用吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆