views:

707

answers:

1

I'm using JQuery to fade-out rows (TR) when the user clicks a Delete button on a row (TR). By fade-out, I mean the entire row (TR) background-color is changed to an off red and then it fades to white and disappears. This is a great little animation for showing the user an instant reaction for what the did.

The JavaScript looks like this:

$(tr).css("background-color", "rgb(255,200,200)");
$(tr).fadeOut(500, RemoveDomElement);

This works beautifully in Firefox, Safari, Opera and Chrome, but - of course - not in IE. IE will execute the code and finish the cleanup, but the actual fade-out animation isn't shown.

What can I do for IE?

+8  A: 

Fade out (and remove) the child cells (TD) instead of the row.

Do this:

$(tr).children().css("background-color", "rgb(255,200,200)");
$(tr).children().fadeOut(500, RemoveDomElement);

Even though each of the TDs is doing it's own thing, this will work quickly enough to the human eye to be the same as just fading/removing the TR.

That means each row fade-out will really be 12 cell fade-outs
So, what's not to like? It'll work fast and clean and give off the same effect.
Nice, thanks. Works well enough
Absolutely. IE does not allow you to apply certain css styles to TRs like other browsers do.
Peter J
Why are you deleting your answers? They are still visible in the history, so it seems like a lot of trouble for not much gain.
Brian Campbell
I've got to ask too, why are you deleting all your non-accepted answers?
Paolo Bergantino
This looks nice in IE8 and worked as desired. Great work around. But in IE8 compatibility mode (should be approx equivalent of IE7) it looks terrible, all the cells change at different rates and it looks very rough. But in IE8 normal mode, then fadeIn() doesn't bring them back after fadeOut(). So once they're gone, they're gone. But in compatibility mode, of course faceIn() DOES bring them back!!! Stupid IE8. I've found so many holes in it its not funny lately. When will the big corporates wake up and stop using it, its nothing but trouble.
Aaron