If you're looking for a simple and effective solution, this might be just what you need (it certainly works for me). The issue of alpha transparency in Internet Explorer can sometimes cause problems when the parent element has a completely transparent background.
The workaround presented here involves adding a nearly transparent div as the first child within the container. By positioning it absolutely and making it almost invisible to the eye, this div acts as the background for all other content inside the container.
This prevents IE from displaying unsightly black pixels or areas when changing opacity settings on the canvas. Here's an example using a 100x100 image:
<div id="mycanvas" style="display:none;">
<div style="position:absolute; background:#FFF; display:block; filter:alpha(opacity=1); opacity:0; width:100px; height:100px;">
</div>
<img id="myImage" src="example.png" width="100" height="100"/>
</div>
To fade in or out the image with jQuery:
$("#mycanvas").fadeIn("slow", function()
{
setTimeout(function(){
$("#mycanvas").fadeOut("slow");
},2000);
});
You can also simply use:
$("myImage").fadeIn("slow");
This approach is compatible with VML/SVG (Raphael) and other elements with alpha transparency, without requiring any changes to your JavaScript code. It's a neat trick that only affects Internet Explorer, leaving other browsers unaffected.
I hope this helps!