jQuery,将opacity设置为1,然后将opacity属性删除,使其在IE上看起来更好 [英] jQuery, Animate opacity to 1 then remove the opacity property to make it better looking on IE
问题描述
我在所有浏览器中都尝试了jQuery fadeIn动画,并且效果很好,但在IE上效果不佳.添加CSS不透明度后,Alpha png图像是如此令人毛骨悚然,但是我有一个主意,我不知道如何使用jQuery来实现它.
I tried the jQuery fadeIn animation in all browsers and it work good, but not that much on IE. the Alpha png images are so creepy after appending the CSS opacity, but i have an idea and i don't know how to implement it using jQuery.
这个想法是在元素中淡入淡出,当动画完成时,它将自动删除opacity属性,以使图片质量更好.
The idea is to fadeIn the element and when the animation is finished it will automatically remove the opacity property in order to make the picture quality better.
该怎么做?
注意:我使用的是Animate,而不是FadeIn.
Note: i'm using Animate and not FadeIn.
谢谢
推荐答案
您可以执行以下操作:
$(selector).animate({opacity: 1}, function() {
$(this).get(0).style.removeAttribute('filter');
});
IE使用的过滤器是导致ClearType基本关闭的原因.像上面的代码一样,在淡入完成后删除该样式属性,以将ClearType恢复为正常工作状态.您还可以在此处找到处理此问题的替换fadeIn()
,fadeOut()
和fadeTo()
方法: http ://malsup.com/jquery/fadetest.html
The filter IE uses is what causes ClearType to basically turn off. Remove that style attribute after the fade completes like the code above to restore ClearType to working order. You can also find replacement fadeIn()
, fadeOut()
and fadeTo()
methods that deal with this issue here: http://malsup.com/jquery/fadetest.html
这篇关于jQuery,将opacity设置为1,然后将opacity属性删除,使其在IE上看起来更好的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!