Funny behaviour...

 

I put out 360 markers on a map.

 

To every marker I try to connect a simple infoWindow (V3) that can be 
clicked up.

 

When I click on *ANY* marker  the map always jumps to the *LAST* location in 
my 

 

list of locations and display that InfoWindow.

 

*Can you please see my mistake in the code?*

 

the* link *is:

*www.arxfoto.se*

click on *uk flag* for language

click on *Places* in left column

click on *Map* on top right

click on *Starting point Sydsverige*

Any marker should have its own infoWindow,

but as you can see the map jumps to China, and acts as if you had clicked on 
this (last in the list) position.

 

the *code *where the mistake most likely is, is where I create the markers 
from the location list:

 

// *'places'* is the list of locations,

// place[0] = name of place, place[1]=Latitude, place[2]=Longitude ...

 

*for*  (var i = 0; i < places.length; i++) *{*    

                  var place = places[i]; 

                  var posit = new google.maps.LatLng(place[1], place[2]); 

                  var contentString =  place[0] + "<br>" + place[1] + "<br>" 
+ place[2];  

                  var infowindow = new google.maps.InfoWindow({  content: 
contentString });  

                  var marker = new google.maps.Marker({position: posit, map: 
map, title:place[0]});  

                  google.maps.event.addListener(marker, 'click', function() 
{ infowindow.open(map,marker); });                 

*}*

* *

It seems that only the last addListener was saved and is applied to any 
marker???

 

thanks for all thoughts!

 

/LarsM

very new to GoogleMAps

-- 
You received this message because you are subscribed to the Google Groups 
"Google Maps JavaScript API v3" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-maps-js-api-v3?hl=en.

Reply via email to