jQuery fadeIn fadeOut - IE8 does not fade

ぐ巨炮叔叔 提交于 2019-11-28 04:34:18
Omeriko

Apparently there's a workaround!

Simply set the absolute/relative positioned elements the following css attributes:

opacity:inherit;
filter:inherit;

E.g:

<div>
<img id='myImg' src='http://mydomain.com' style='position:absolute;top:10px;left:5px;filter:inherit;opacity:inherit' />
</div>

Have fun,

Omer

I figured it out, css setting position:relative on the image, aparently ie8 doesn't like that, is there a workaround I wonder, the search begins.

I just had this problem, and all the css ticks didn't worked. The fadeIn/Out worked on FF and Chrome, but not in IE8, the element didn't showed up at all. In IE7 they just went from invisible to visible.

So to fix my problem I just wanted to keep the fadeIn/Out on the other browsers and make the elements appear in IE8. The solution was to use the callback like so:

$(".elements").fadeIn("slow",function(){$(this).show()}):
$(".elements").fadeOut("slow",function(){$(this).hide()}):

This way I always force the result I want in the end.

For a quick and dirty fix (or if the suggestions above are just not working, as is my case) you can simply replace jQuery's fadeIn/fadeOut with show/hide. So in the html do:

<!--[if IE]>
<script type="text/javascript src="ieFixes.js"></script>
<![endif]-->

and in some javascript file of IE hacks (eg ieFixes.js) put:

jQuery.fn.fadeIn = function() {
    this.show();
}

jQuery.fn.fadeOut = function() {
    this.hide();
}

You'll have to tweak this a bit if you're chaining animate calls, etc.

Replace your image with a div (of the same size) with a background image and fade-in/-out the div.

<div style="background-image:url('paper.gif');height:xxxpx;width:xxxpx"></div>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!