we want to keep a reference to the close div in our popups if we make it. (Closes #1334)

git-svn-id: http://svn.openlayers.org/trunk/openlayers@6048 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
euzuro
2008-02-07 23:59:54 +00:00
parent 870e196c20
commit 6c2dfdeaf1

View File

@@ -90,6 +90,12 @@ OpenLayers.Popup = OpenLayers.Class({
*/
groupDiv: null,
/**
* Property: closeDiv
* {DOMElement} the optional closer image
*/
closeDiv: null,
/**
* Property: padding
* {int} the internal padding of the content div.
@@ -157,19 +163,18 @@ OpenLayers.Popup = OpenLayers.Class({
// close icon
var closeSize = new OpenLayers.Size(17,17);
var img = OpenLayers.Util.getImagesLocation() + "close.gif";
var closeImg = OpenLayers.Util.createAlphaImageDiv(this.id + "_close",
null,
closeSize,
img);
closeImg.style.right = this.padding + "px";
closeImg.style.top = this.padding + "px";
this.groupDiv.appendChild(closeImg);
this.closeDiv = OpenLayers.Util.createAlphaImageDiv(
this.id + "_close", null, closeSize, img
);
this.closeDiv.style.right = this.padding + "px";
this.closeDiv.style.top = this.padding + "px";
this.groupDiv.appendChild(this.closeDiv);
var closePopup = closeBoxCallback || function(e) {
this.hide();
OpenLayers.Event.stop(e);
};
OpenLayers.Event.observe(closeImg, "click",
OpenLayers.Event.observe(this.closeDiv, "click",
OpenLayers.Function.bindAsEventListener(closePopup, this));
}