[OpenLayers-Users] registering a click on a marker
Eric Lemoine
eric.c2c at gmail.com
Mon Apr 7 00:50:59 EDT 2008
On Mon, Apr 7, 2008 at 5:17 AM, Tara Athan <tara_athan at alt2is.com> wrote:
> I am confused about how to register an event on a marker.
> I have a marker layer at a coarse resolution, with markers assigned to
> different variables.
> I would like to have a click on the marker cause a zoom in to that
> location, plus a replacement of the makers with a new set of markers
> that show more detail for that location. I am using code like this
>
> function handleMarkerClickEU(evt) {
> map.setCenter(new OpenLayers.LonLat(13.000000,51.000000), 3);
> var vols_cyball = new OpenLayers.Layer.Markers( 'volunteers
> living in Europe (balloons)');
> var vols_cynumb = new OpenLayers.Layer.Markers( 'volunteers
> living in Europe (numbers)');
> var vols_cytext = new OpenLayers.Layer.Text( "text", {location:
> "../data/volsTextCYEU_utf8.csv"});
> map.addLayers([vols_cyball, vols_cynumb, vols_cytext]);
> <?php include 'volsBalloonsAndNumbersCYEU_utf8.php'; ?>
>
> map.removeLayer(vols_ctball);
> map.removeLayer(vols_ctnumb);
> }
>
> var markerEU = new OpenLayers.Marker(new
> OpenLayers.LonLat(13.000000,51.000000),icon);
> vols_ctball.addMarker( markerEU);
> markerEU.events.register("onclick" , markerEU, handleMarkerClickEU);
Hi, try "click" instead of "onclick" ?
--
Eric
More information about the Users
mailing list