google maps - display multiple pin balloons simultaneously (pins share common title text) -
is there method allow multiple google map location pins display attribute balloons simultaneously, when pins share same text string in pin title? eg have plotted addresses of 3 branch offices of business on places map. each branch office has same 'business name' main pin title. when click on 1 of these 3 pins, want 3 of them simultaneously display info text balloons.
there no built-in method in api can setup own. involves create multiple infowindow objects.
create array hold markers. create each marker , corresponding infowindow. force each marker array, along infowindow object.
markers.push([marker, infowindow]); on marker click, loop through markers array , check each title. if corresponds clicked marker title, open corresponding infowindow.
function markerclick(marker) { (var = 0; < markers.length; i++) { if (markers[i][0]['title'] === marker['title']) { markers[i][1].open(map, markers[i][0]); } } } see working demo here: http://jsfiddle.net/upsidown/xcykq/
google-maps google-maps-api-3
No comments:
Post a Comment