[OpenLayers-Users] IE6 performance

Paul Spencer pagameba at gmail.com
Tue Nov 13 07:46:08 EST 2007


Chris,

On 12-Nov-07, at 10:36 AM, Christopher Schmidt wrote:

>  ... however, since the alpha-png hack is *always* applied, you'd have
> to do some hacking to turn that off. (Actually,
> OpenLayers.Util.alphaHack = function() { return false; } would
> accomplish that for you.)

In ka-Map (and other projects), we've used a css class .png24 to apply  
the alpha hack to only selected images.  Would it be feasible to do  
this with OpenLayers too?

The css class is defined as follows:

.png24 {
   filter:expression(applyPNGFilter(this));
}

Only IE supports execution of javascript in css class, so this is  
automatically safe from other browsers.

the javascript function is:

applyPNGFilter = function(o)  {
    var t=Jx.baseURL + "images/a_pixel.png";
    if( o.src != t ) {
        var s=o.src;
        o.src = t;
        o.runtimeStyle.filter =  
"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+s 
+"',sizingMethod='scale')";
    }
};

This only works when you first insert an image into the DOM with this  
class, but it could be adapted to support changing a url on an  
existing image and optionally testing to see if the image has a  
className of png24 before applying it.

If you think this is the right way to go, then I will create a patch  
based on this approach.  If you think there is a better approach, I'm  
willing to try something else too.

Cheers

Paul



More information about the Users mailing list