我怎样才能让谷歌地图标记变大时,鼠标悬停呢? [英] How can I make google map marker grow bigger when the mouseover it?
问题描述
在谷歌地图API第3版,标题,我只看到了2种在谷歌地图API的动画,但我在一些地方的地图标记动画一样长得大,当鼠标悬停在上面看到了?如何实现这一点?
In Google Map API v3, as the title, I only saw 2 types of animation in google map api, but I saw in some places the map marker animate like grow big when mouse over it? How to implement this?
推荐答案
使用标记的鼠标悬停事件处理程序和的setIcon()
方法。您可以使用动态图标从谷歌图表API的的为此目的,并更改 CHLD
属性,使图标成长:
Use marker's mouseover event handler and setIcon()
method. You can use dynamic icons from google chart api for this purpose, and change the chld
attribute to make the icon grow:
的 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 | _ |
不要忘记设置正确的定位点!例如:
Don't forget to set proper anchor point! For example:
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
));
这篇关于我怎样才能让谷歌地图标记变大时,鼠标悬停呢?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!