【发布时间】:2012-01-05 15:42:43
【问题描述】:
在 Google Map API v3 中,如标题所示,我在 google map api 中只看到了 2 种类型的动画,但我在某些地方看到地图标记的动画就像鼠标悬停时变大一样?如何实施?
【问题讨论】:
标签: google-maps animation google-maps-api-3 google-maps-markers
在 Google Map API v3 中,如标题所示,我在 google map api 中只看到了 2 种类型的动画,但我在某些地方看到地图标记的动画就像鼠标悬停时变大一样?如何实施?
【问题讨论】:
标签: google-maps animation google-maps-api-3 google-maps-markers
使用标记的鼠标悬停事件处理程序和setIcon() 方法。为此,您可以使用来自 google chart api 的 dynamic icons,并更改 chld 属性以使图标变大:
http://chart.googleapis.com/chart?chst=d_map_spin&chld=0.5|0|FF8800|15|_|
http://chart.googleapis.com/chart?chst=d_map_spin&chld=0.6|0|FF8800|15|_|
http://chart.googleapis.com/chart?chst=d_map_spin&chld=0.7|0|FF8800|15|_|
别忘了设置合适的锚点!例如:
marker.setIcon(new google.maps.MarkerImage(
'http://chart.googleapis.com/chart?chst=d_map_spin&chld=0.65|0|FF8800|15|_|',
null,
null,
new google.maps.Point(11, 43) // this is the proper anchor point for scale 0.65
));
【讨论】:
您可以使用自己的图像作为标记,然后使用标记图像的scaledSize 属性使其在mouseover 事件触发时变大。
如果不做一些更复杂的事情,我不知道如何做到这一点。
【讨论】: