/ / Google Maps Marker Animationsは動作していません - javascript、google-maps、google-maps-api-3

Google Maps Marker Animationsは動作していません - javascript、google-maps、google-maps-api-3

このコードは動作しますが、マウスで各マーカーをクリックすると、マーカーアニメーションBOUNCEは表示されません。

for(i=0; i<locations.length; i++) {
var position = new google.maps.LatLng(locations[i][2], locations[i][3]);
var marker = new google.maps.Marker({
position: position,
map: map,
icon: new google.maps.MarkerImage(locations[i][5]),
animation: google.maps.Animation.DROP
});
google.maps.event.addListener(marker, "click", (function(marker, i) {
return function() {
infowindow.setContent(locations[i][1]);
infowindow.setOptions({maxWidth: 500});
infowindow.open(map, marker);
}
animation: google.maps.Animation.BOUNCE

}) (marker, i));

Markers[locations[i][4]] = marker;
}

回答:

回答№1は0

クリックコールバックでアニメーションを設定する:

return function() {
//set the animation
this.setAnimation(google.maps.Animation.BOUNCE);

infowindow.setContent(locations[i][1]);
infowindow.setOptions({maxWidth: 500});
infowindow.open(map, marker);
}