http://koti.mbnet.fi/ojalesa/boundsbox/makemarker_sidebar_plain.htm . (pero este codigo no me sive ya que inicializo distinto los markers):
Código HTML:
poiTable: function(){ var geocoder = new google.maps.Geocoder(); var address; googleMaps.pointsArray=[]; googleMaps.clusterStyles=[]; var map = googleMaps.map; googleMaps.getWS( "llista_POIs", function(data){ $.each(data.llistaPOI, function(index,value){ address= value["POI_postal"] + "," + value["POI_ciutat"]; geocoder.geocode( { 'address': address}, function(results, status) { $("#llistaPOI").append('<li><div class="POIElement" id="POI'+value["id"]+'"><span>'+value["POI_name"]+'</span></div></li>'); if (index < data.llistaPOI.length -1) { if (status == google.maps.GeocoderStatus.OK) { googleMaps.map.setCenter(results[0].geometry.location); var markerId = "marker" + Math.floor(Math.random()*1000000); $('.map_container').gmap('addMarker', { 'position': results[0].geometry.location.lat()+','+results[0].geometry.location.lng(), 'bounds': true, 'icon': new google.maps.MarkerImage('http://images.com/green_marker.png', new google.maps.Size(29,40), new google.maps.Point(0,0), new google.maps.Point(0,40) ) }, function(map, marker){ googleMaps.map=map; $(marker).click(function(){ var bubble = new InfoBubble({ content: "<span>"+value['POI_name']+"</span><p>", map:googleMaps.map, shadowStyle: 1, padding: 0, backgroundColor: 'rgb(255,255,255)', arrowSize: 10, borderWidth: 1, borderColor: 'lightgray', disableAutoPan: false, hideCloseButton: false, arrowPosition: 50, backgroundClassName: '', arrowStyle: 0 }); bubble.open(map, marker); }); } ); googleMaps.clusterStyles.push({ opt_textColor: 'transparent', textColor: '#000000', url: 'http://images.com/green_cluster.png', height: 35, width: 35 }); } else { alert("Geocode was not successful for the following reason: " + status); } } else{ googleMaps.clusteringMarkers($('.map_container').gmap('get', 'markers')); googleMaps.poiWindow(); } }); }); }); },