1

I have some problem with the popup code in OpenLayers, using Text layer (yes i know there already GML layer out there with text format, but i need to modify existing code), the problem was popup not removed when i open new popup (by clicking another marker)


OpenLayers.Feature.prototype.popupClass = OpenLayers.Popup.FramedCloud;

        OpenLayers.Layer.Text.prototype.markerClick = function(evt) {
            var sameMarkerClicked = (this == this.layer.selectedFeature);
            if (this.popup) {
                this.popup.toggle(); 
            } else {
                this.layer.map.addPopup(this.createPopup(true));
            }
            this.layer.selectedFeature = (!sameMarkerClicked) ? this :
null;
            OpenLayers.Event.stop(evt);        
        } 

code by Christopher Schmidt : http://www.mail-archive.com/users@openlayers.org/msg03869.html

2

I've successfully used the functions from this post: http://lists.osgeo.org/pipermail/openlayers-users/2009-August/013002.html

1

As far as I know, in an OpenLayers map viewer showing a new popup window does not imply that other already present popup windows will automatically be closed (at least when I was working with OpenLayers, more that 1 year ago).

You can get such behaviour by (a) having a list of references to already open popup windows, (b) close all popups present in this list when opening a new popup window and (c) updating the list.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.