views:

1230

answers:

3

I can't get the table row to fade out in IE. It works in Chrome, but not IE. It just becomes really 'light' and stays on the screen. I tried IE8 with and without compatibility mode.

<html>
<head>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">

function hideIt()
{
    $('#hideme').fadeTo("slow", 0.0);
}

</script>
</head>
<body>
<table>
 <tr id='hideme'>
  <td>Hide me!</td>
 </tr>
</table>
<button onclick='hideIt();'>Hide</button>
</body>
</html>

Is there a workaround/solution for a smooth fade?

+5  A: 

Yeah, that's a bug (feature?) in IE. If you apply it to the td elements instead of the tr, you'll get the desired effect. So,

$('#hideme>td').fadeTo("slow", 0.0);
James Kolpack
Awesome. Works like a charm now.
George Edison
A: 

Here is what I ended up doing, and it worked pretty good in everything, although quite complicated (and with some bugs - more on that in a minute - see if you can spot it):

function FadeInFrom(item,from_bg,from_fg,call)
{
    $to_bg = $(item).css('background-color');
    $(item).css('background-color',from_bg);

    $to_fg = $(item + '>td').css('color');
    $(item + '>td').css('color',from_fg);

    var anim = {};
    anim['backgroundColor'] = $to_bg;

    $(item).animate(anim,'slow');

    var anim2 = {};
    anim2['color'] = $to_fg;

    $(item + '>td').animate(anim2,'slow');
}

What this does is get the current color of the item, and then animates it to that color from the specified colors.

As for that bug, if you try the code above, you will notice that links and other DOM items may not be animated correctly by this. I leave it up to someone to try to find a solution for that.

George Edison
A: 

I am having a similar issue with IE 6. In my case the image(.png) completely disappears. Here is the code looking for assistance. Thanks in advance

$(function () {
    $('.blink').hover(function() {
 $(this).fadeTo("fast", 0.5);
 }, function() {
 $(this).fadeTo("fast", 1);
    });

}); 
Sid
You would probably get a better answer if you posted this as a new question.
George Edison