[OpenLayers-Users] Adding multiple anchored popups

Erik Uzureau erik.uzureau at metacarta.com
Mon Jan 7 12:39:38 EST 2008


The "exclusive" property of the addPopup() method on the map might
have something to do with this...

    /**
     * APIMethod: addPopup
     *
     * Parameters:
     * popup - {<OpenLayers.Popup>}
     * exclusive - {Boolean} If true, closes all other popups first
     */
    addPopup: function(popup, exclusive) {

        if (exclusive) {
            //remove all other popups from screen
            for (var i = this.popups.length - 1; i >= 0; --i) {
                this.removePopup(this.popups[i]);
            }
        }

        popup.map = this;
        this.popups.push(popup);
        var popupDiv = popup.draw();
        if (popupDiv) {
            popupDiv.style.zIndex = this.Z_INDEX_BASE['Popup'] +
                                    this.popups.length;
            this.layerContainerDiv.appendChild(popupDiv);
        }
    },

On 12/20/07, Bradley McLain <bradley_mclain at debortoliwines.com> wrote:
> Currently I have an array of location details that I am running through a
> simple while loop to populate my map with markers.
>
> This is working perfect and is as follows.
>
>  var markers = new OpenLayers.Layer.Markers
( "Markers" );
>  map.addLayer(markers);
>
>  //Setting Size and Offset of Markers
>  var size = new OpenLayers.Size(20,34);
>  var offset = new OpenLayers.Pixel(-(size.w/2), -size.h);
>
>  var site = 0;
>
>  while (site < locationList.length)
>  {
>  var icon = new
> OpenLayers.Icon('../../img/gmarker.png',size,offset);
>  markers.addMarker(
>  new OpenLayers.Marker(new
> OpenLayers.LonLat(locationList[site].lon,locationList[site].lat),icon));
>
>  site++;
>
>  }
>
> What I want to do is add anchored popups to all of these markers, having
> each one work properly, I've tried hacking around with the example but I can
> only ever get one to add at a time.
>
> Any help with this would be much appreciated.
>
> Brad
>
>
>
>
>
>
>
>
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>
>



More information about the Users mailing list