Stop jQuery animation prematurely
Posted
by jcovert
on Stack Overflow
See other posts from Stack Overflow
or by jcovert
Published on 2010-03-31T21:44:43Z
Indexed on
2010/03/31
21:53 UTC
Read the original article
Hit count: 472
Hi, I'm trying to fadeIn and fadeOut a transparent png using JQuery. Of course, it looks slick in Firefox, but significantly less than acceptable in IE (7 and 8). It's a known bug with IE, and unfortunately there doesn't seem to be much of a workaround.
Basically what I'm doing is place a semi-transparent white rectangle over an image to make the image appear 'in the background'. I want to do this smoothly, and that's where fadeIn comes in. Because of the IE bug, however, I've been forced to fadeIn a completely opaque white rectangle over the image instead, making it unfortunately disappear. While this looks significantly better and is ALMOST what I'm looking for, it's still not acceptable. The user needs to be able to see SOME image on the page, albeit in the background.
So my question is this:
Is there a way to stop the fadeIn function (or any jquery animation, really) after animating for 75% of its expected animation time?
This would leave my image 75% mixed the white rectangle, and I wouldn't have to deal with IE's nasty transparent png bug.
Thanks!
© Stack Overflow or respective owner