[OpenLayers-Users] Click popups on marker objects.

Keith kweber at archetypecorp.com
Tue Feb 27 10:58:50 EST 2007


Hi.  I'm just getting started with OpenLayers, so please forgive some of the
more trivial questions.

 

I've been through most of the mailing list, live examples, and OpenLayers
API, but have missed this information if it's there.

 

Currently, I just want to create a marker on the map, and create a popup
when I click on on it.  Eventually, I want to implement the tabbed popup
from slippy map, but need to take baby steps while I learn.

 

I have the following code:

 

----------------------------------------------------------------------------
-------------------------------------------

var markersLayer = new OpenLayers.Layer.Markers("Tracking Icons");  

map.addLayer(markersLayer);   

    

var marker = new OpenLayers.Marker(

                        new OpenLayers.LonLat(x_coord, y_coord),

                        new
OpenLayers.Icon("/kamap/mapserver/images/AQUA.png",new
OpenLayers.Size(20,34)));

 

markersLayer.addMarker(marker);

 

var testPopup = new OpenLayers.Popup("test popup", 

                        new OpenLayers.LonLat(  X_COORD  , Y_COORD  ),

                        new OpenLayers.Size(200,200),

                        "test popup",

                        true);   

 

marker.events.register("click", marker, 

            function (e) {

                   map.addPopup(testPopup,true);

            }     );

 

----------------------------------------------------------------------------
-------------------------------------------

 

 

This code displays the marker just fine.  When I click the marker, the
default popup comes up fine and closes upon hitting the "close" button.  The
real problem is that this only happens once.  After the first time, the
popup won't appear again upon click unless reloading the page.

 

Can someone help me get a handle on what's going on?

 

 

Thanks,

 

Keith Weber
Archetype, Inc.
205.443.6560 office
kweber at archetypecorp.com

 

 


The information transmitted is the property of Archetype, Inc. and is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Statements and opinions expressed in this e-mail may not represent those of the company.  Any review, retransmission, dissemination and other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender immediately and delete the material from any computer. E-mail transmission cannot be guaranteed to be secured or error-free as information could be intercepted, corrupted, lost, destroyed, received late or incomplete, or could contain viruses. The sender therefore does not accept liability for any error or omission in the contents of this message, which arises as a result of e-mail transmission.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20070227/5902d881/attachment.html


More information about the Users mailing list