这是我在 Google 地图 V3 上一一放置每个标记的简单工作示例。当标记添加到谷歌地图时,我已经设置了放置动画。
但是我想用 Fade Animation 自定义 Drop 是否可以使用任何 Javascript Stuff 或其他库?
谷歌在命名空间中有这个选项我们可以在命名空间中添加我们的自定义动画选项吗?
- google.maps.Animation.DROP
- google.maps.Animation.BOUNCE
- google.maps.Animation.CUSTOM_FADE(有可能吗?)
我的谷歌地图 V3 工作代码
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<title>Google Maps Multiple Markers</title>
<script src="http://maps.google.com/maps/api/js?sensor=false"
type="text/javascript"></script>
</head>
<body>
<div id="map" style="width: 500px; height: 400px;"></div>
<script type="text/javascript">
var locations = [
['Bondi Beach', -33.890542, 151.274856, 4],
['Coogee Beach', -33.923036, 151.259052, 5],
['Cronulla Beach', -34.028249, 151.157507, 3],
['Manly Beach', -33.80010128657071, 151.28747820854187, 2],
['Maroubra Beach', -33.950198, 151.259302, 1]
];
var map = new google.maps.Map(document.getElementById('map'), {
zoom: 10,
center: new google.maps.LatLng(-33.92, 151.25),
mapTypeId: google.maps.MapTypeId.ROADMAP
});
var infowindow = new google.maps.InfoWindow();
var marker, i;
function marker(i) {
if (i > locations.length) return;
var marker;
marker = new google.maps.Marker({
position: new google.maps.LatLng(locations[i][1], locations[i][2]),
animation: google.maps.Animation.DROP,
map: map
});
var t=setTimeout("marker("+(i+1)+")",500);
}
marker(0);
</script>
</body>
</html>