The only way to do it is to keep an array of references to your markers
when you create them, and keep a link to the corresponding sidebar
entries.
Listen for moveend events (because moves can bring markers in and out of
view as well as zooms). When one occurs, scan through your array of
markers testing each one to see if it is inside the map.getBounds()
var sidebar_html = "";
var bounds = map.getBounds()
for (i=0; i<gmarkers.length; i++) {
if (bounds.containsLatLng(gmarkers[i].getLatLng()) {
// recreate the sidebar entry for marker i
sidebar_html += '<a href="javascript:myclick(' + i + ')">' +
gmarkers[i].myname + '<\/a><br>';
}
}
document.getElementById("sidebar").innerHTML = sidebar_html;
However, you may find that doing this makes it very difficult for people
to navigate your map. "I'm sure I saw a marker for Foo somewhere on this
map, but I can't see it in the side bar".
--
http://econym.org.uk/gmap
The Blackpool Community Church Javascript Team
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Maps API" 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-API?hl=en
-~----------~----~----~----~------~----~------~--~---