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

Sorry forgot to mention nice1 adapting Bobs code, you noticed any
performance increases? I've found using PNG techniques on more than a few
IMG tags results in pages loading, then, images being updated to display
correctly and doesn't look too hot for those poor IE6 users.


-----Original Message-----
From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Devin
Sent: 19 May 2007 02:21
To: jQuery (English)
Subject: [jQuery] jQuery PNG Fix


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