This small plugin function adds the ability to "fix" PNG alpha transparency in Internet Explorer pre version 7. It uses the <span> wrap trick from http://www.howtocreate.co.uk/alpha.html.
Due to the use of browser version checking, Dave Cardwell's jQBrowser plugin is required as well.
Code
jQuery.fn.pngFix = function() {
return this.each(function() {
if ($.browser.msie() && $.browser.version.number() < 7) {
$(this).css("filter","progid:DXImageTransform.Microsoft.Alpha(opacity=0);").wrap("<span style="width:" + $(this).width() + "px; height: " + $(this).height() + "px; display:inline-block; filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + $(this).src() + "');"></span>");
}
});
};
Usage
$("img[@src$=png]").pngFix();
