当鼠标悬停时,如何使谷歌地图标记变得更大?

xmu*_*obi 5 animation google-maps google-maps-api-3 google-maps-markers

在谷歌地图API v3中,作为标题,我只在谷歌地图api中看到了两种类型的动画,但是我在某些地方看到地图标记的动画效果就像鼠标悬停在它上面一样大?怎么实现这个?

TMS*_*TMS 3

使用标记的鼠标悬停事件处理程序和setIcon()方法。您可以使用google Chart api 中的动态图标来实现此目的,并更改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
));
Run Code Online (Sandbox Code Playgroud)