I have multiple markers in an bounds. I want to animate or highlight particular marker in an onclick
event from html.
Map code:
var map = new google.maps.Map(document.getElementById('map-canvas'), {
mapTypeId: google.maps.MapTypeId.ROADMAP
});
list = [
[51.503454,-0.119562],
[51.499633,-0.124755]
];
var bounds = new google.maps.LatLngBounds();
list.forEach(function(data, index, array){
var marker = new google.maps.Marker({
position: new google.maps.LatLng(list[index][0],list[index][1]),
map: map
});
bounds.extend(marker.position);
});
map.fitBounds(bounds);
I want to animate a particular marker in an map from a html onclick
.
<button onclick="showme(0)">London Eye</button>
<button onclick="showme(1)">Palace of Westminster</button>
Js:
showme = function(index){
//How to animate a particular marker by an index?
}