On Jan 9, 8:02 am, Marky <[email protected]> wrote: > I have changed my code from an example i saw online so that there is now > a separate function which sets the infowindow information. This example > still doesn't work for me fully but it works better. It gets stuck in the > evenListener again though. It will only plot one marker on the map and it > will not have an infowindow attached to it. I just can't figure out these > action listeners. If i take out the listener, it works perfectly and plots > all my markers. > > var markersArray = new Array(); > > while (j < latArray.length) > > { > > var myLatLng = new google.maps.LatLng(latArray[j], lonArray[j]); > > markersArray[j] = new google.maps.Marker({ > > position: myLatLng, > > map: map, > > animation: google.maps.Animation.DROP > > }); > > attachInfo(markers[j], j); // call function outside of loop > > j++; > > } > > function attachInfo(marker, num) > > { > > var infowindow = new google.maps.InfoWindow({ content: "insert > content here"}); > > google.maps.event.addListener(marker, 'mouseover', function() > > { > > infowindow.open(map,marker); > > }); > > }
Search for "pitfall #3": http://groups.google.com/group/google-maps-js-api-v3/search?group=google-maps-js-api-v3&q=pitfall+%233&qt_g=Search+this+group or if you want help, follow the posting guidelines and post a link to your map that shows the problem: http://groups.google.com/group/google-maps-js-api-v3/t/2b3f101fd509919e -- Larry -- 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.
