jQuery:在IE中动画不透明度 [英] jQuery: Animating opacity in IE

查看:84
本文介绍了jQuery:在IE中动画不透明度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用纯黑色的div来淡出其下方的图片。在Chrome和Firefox中,这项工作正常,但在IE中,它是向后的。

Using a div with solid black color to fade out an image underneath it. In Chrome and Firefox, this works fine, however, in IE, it's backwards.

$("div#bgcover").animate( {opacity:.70}, 2500);

这从0%不透明度开始,应该随着时间的推移动画到70%。然而,在IE中,它从0%跳到100%,然后回落到70%。

This starts at 0% opacity and is supposed to animate to 70% over time. In IE, however, it jumps from 0% to 100%, and then fades back down to 70%.

寻找这个问题的修复。感谢。

Looking for a fix for this. Thanks.

推荐答案

尝试在将动画设为动画之前将不透明度设置为零:

Try to set the opacity to zero before you animate it:

$("div#bgcover").css({ opacity: 0.0 }).animate( {opacity:.70}, 2500);

这篇关于jQuery:在IE中动画不透明度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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