Ah, yes, that seems like a really elegant solution. My problem was the
massive amount of transparent PNGs my site was already using. Going
back and applying a class to each image would be less
counter-productive. I can see his implementation breaking in more ways
than just traversing the DOM for img tags and applying it within. I
love the insight though, maybe there's something I can use from Klaus'
solution.

-Devin

On 5/18/07, Glen Lipka <[EMAIL PROTECTED]> wrote:
Im using this one right now.
http://www.stilbuero.de/2006/03/15/png-alpha-transparency-fast-and-easy/

Glen


On 5/18/07, Devin <[EMAIL PROTECTED]> wrote:
>
> 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