[OpenLayers-Dev] IE PNG hack/fix - hopefully better now

Bernd Lackinger Bernd.Lackinger at plot.at
Tue May 27 13:40:14 EDT 2008


This is just a really quick fix - needs a transparent gif in the right
place ;-)




/** 
 * Function: modifyAlphaImageDiv
 * 
 * div - {DOMElement} Div containing Alpha-adjusted Image
 * id - {String}
 * px - {<OpenLayers.Pixel>}
 * sz - {<OpenLayers.Size>}
 * imgURL - {String}
 * position - {String}
 * border - {String}
 * sizing {String} 'crop', 'scale', or 'image'. Default is "scale"
 * opacity - {Float} Fractional value (0.0 - 1.0)
 */ 
OpenLayers.Util.modifyAlphaImageDiv = function(div, id, px, sz, imgURL, 
                                               position, border, sizing,

                                               opacity) {

    OpenLayers.Util.modifyDOMElement(div, id, px, sz, 
                                     null, null, null, opacity);

    var img = div.childNodes[0];

    if (imgURL) {
        img.src = imgURL;
    }
    OpenLayers.Util.modifyDOMElement(img, div.id + "_innerImage", null,
sz, 
                                     "relative", border);
    
    if (OpenLayers.Util.alphaHack()) {

        img.onload = function(){  // INSERTED

          div.style.display = "inline-block";
          if (sizing == null) {
              sizing = "scale";
          }
          
          div.style.filter = "progid:DXImageTransform.Microsoft" +
                             ".AlphaImageLoader(src='" + img.src + "', "
+
                             "sizingMethod='" + sizing + "')";
          if (parseFloat(div.style.opacity) >= 0.0 && 
              parseFloat(div.style.opacity) < 1.0) {
              div.style.filter += " alpha(opacity=" + div.style.opacity
* 100 + ")";
          }
  
          img.style.filter = "alpha(opacity=0)";

        };  // INSERTED

        

        
    }
};



Bernd Lackinger
-------------------------------------------------
PL.O.T EDV Planungs- und HandelsgesmbH


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-dev/attachments/20080527/63c114e6/attachment.html


More information about the Dev mailing list