This is a jQuery plugin I created to adapt pngfix.js from Bob Osola to
use the jQuery framework.

If anybody has any further recommendations or improvements, don't
hesitate to let me know. :-)

$(document).ready(function(){

if ($.browser.msie && (document.body.filters))  {
         $("img").each(function(i){
                var imgName = $.trim(this.src.toLowerCase());

                if (imgName.substring(imgName.length-3, imgName.length) == 
"png") {
                        var imgID = (this.id) ? "id='" + this.id + "' " : "";
                        var imgClass = (this.className) ? "class='" + 
this.className + "'
" : "";
                        var imgTitle = (this.title) ? "title='" + this.title + 
"' " :
"title='" + this.alt + "' ";
                        var imgStyle = "display:inline-block;" + 
this.style.cssText;

                        if (this.align == "left") {
                                imgStyle = "float:left;" + imgStyle;
                        }

                        if (this.align == "right") {
                                imgStyle = "float:right;" + imgStyle;
                        }

                        if (this.parentElement.href) {
                                imgStyle = "cursor:hand;" + imgStyle;
                        }

                        this.outerHTML = "<span " + imgID + imgClass + imgTitle
                                + " style=\"" + "width:" + this.width + "px; 
height:" +
this.height + "px;" + imgStyle + ";"
                                + 
"filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=
\'" + this.src + "\', sizingMethod='scale');\"></span>";
                }
        });
}

});

Reply via email to