new function to create an alpha-transparency protected image -- burried in a div. This is for Ticket #25
git-svn-id: http://svn.openlayers.org/trunk/openlayers@362 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -670,6 +670,45 @@ OpenLayers.Util.createImage = function(img, sz, xy, position, id, border) {
|
||||
return image;
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {String} imgURL
|
||||
* @param {OpenLayers.Size} sz
|
||||
* @param {OpenLayers.Pixel} px
|
||||
* @param {String} position
|
||||
* @param {String} id
|
||||
* @param {int} border
|
||||
*
|
||||
* @returns A DOM Div created with a DOM Image inside it. If the hack is
|
||||
* needed for transparency in IE, it is added.
|
||||
* @type DOMElement
|
||||
*/
|
||||
OpenLayers.Util.createAlphaImageDiv = function(imgURL, sz, px, position,
|
||||
id, border) {
|
||||
|
||||
var div = OpenLayers.Util.createDiv(id, px, sz);
|
||||
var img = OpenLayers.Util.createImage(imgURL, sz, null, "relative",
|
||||
id + "innerImage", border);
|
||||
div.appendChild(img);
|
||||
|
||||
|
||||
var arVersion = navigator.appVersion.split("MSIE");
|
||||
var version = parseFloat(arVersion[1]);
|
||||
|
||||
var alphaHack = ( (document.body.filters) &&
|
||||
(version >= 5.5) && (version < 7) );
|
||||
|
||||
if (alphaHack) {
|
||||
div.style.display = "inline-block";
|
||||
div.style.filter = "progid:DXImageTransform.Microsoft" +
|
||||
".AlphaImageLoader(src='" + imgURL + "')";
|
||||
img.style.filter = "progid:DXImageTransform.Microsoft" +
|
||||
".Alpha(opacity=0)";
|
||||
img.width = img.style.width;
|
||||
img.height = img.style.height;
|
||||
}
|
||||
|
||||
return div;
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {Object} params
|
||||
|
||||
Reference in New Issue
Block a user