Thanks for the tip.
I have added :
var bounds = new GLatLngBounds();
for (var i = 0; i < markers.length; i++) {
var naam = markers[i].getAttribute('naam');
var soort = markers[i].getAttribute('soort');
var km = markers[i].getAttribute('km');
var hm = markers[i].getAttribute('hm');
var id = markers[i].getAttribute('id');
var terrein = markers[i].getAttribute('terrein');
var distance =
parseFloat(markers[i].getAttribute('distance'));
var point = new
GLatLng(parseFloat(markers[i].getAttribute('lat')),
parseFloat(markers[i].getAttribute('lng')));
var marker = createMarker(point, naam, terrein, soort, km,
hm, id);
map.addOverlay(marker);
var sidebarEntry = createSidebarEntry(marker, naam, terrein,
distance, km, hm, id, soort);
sidebar.appendChild(sidebarEntry);
bounds.extend(point);
}
map.setCenter(bounds.getCenter(), map.getBoundsZoomLevel(bounds));
and in the end:
function createSidebarEntry(marker, naam, terrein, distance, km, hm,
id, soort) {
var div = document.createElement('div');
var html = '<table><tr><td><img src="' + soort + '"/></
td><td><b>' + naam + '</b> (' + distance.toFixed(1) + ')<br><b> KM:</
b> ' + km + ' <b>HM:</b> ' + hm + '</td></tr></table>' ;
div.innerHTML = html;
div.style.cursor = 'pointer';
div.style.marginBottom = '5px';
GEvent.addDomListener(div, 'click', function() {
GEvent.trigger(marker, 'click');
map.setCenter(marker.getLatLng(), 16 );
});
this will do the job.
thanks for looking into it.
--
You received this message because you are subscribed to the Google Groups
"Google Maps API V2" 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.