此代码有效,但当我点击每个标记时,Marker not Animation 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;
}
答案 0 :(得分: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);
}