谷歌地图API V3鼠标悬停多边形? [英] google maps v3 API mouseover with polygons?

查看:177
本文介绍了谷歌地图API V3鼠标悬停多边形?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我建设使用谷歌版API,因为它是这样快的地图。从本质上讲,它是一个区域与多边形在地区的约30个城市的地图。当用户将鼠标悬停在一个城市,我想将fillColor获得较轻的,然后返回到它在的mouseout正常状态。当用户点击,它重定向到另一个页面。

I'm building a map using the google v3 api because it is way faster. Essentially, it's a map of an area with about 30 cities with polygons over the regions. When a user hovers over a city, I want the fillColor to get lighter, and then return to it's normal state on mouseout. when a user click, it redirects them to another page.

单击事件工作得很好。不过,翻翻v3的API文档,它好像谷歌已经实现单击,双击,鼠标移动,鼠标按下和MouseUp作为事件触发,但没有悬停或鼠标悬停,或mouseout事件。

The click event works just fine. But, looking through the v3 API documentation, it seems as if Google has implemented click, doubleclick, mousemove, mousedown and mouseup as event triggers, but no hover, or mouseover, or mouseout.

真的吗?吉兹。我会考虑和淘汰工作将优先级高于向下和向上。

Really? Geez. I'd think over and out would be higher priority than down and up.

总之,有其他人遇到过吗?我错了吗?还是有解决方法吗?

Anyway, has anybody else come across this? Am I wrong? Or is there a workaround?

感谢您在您的帮助, 萧蔷

Thank you in advance for your help, Stephanie

推荐答案

以下工作:

google.maps.event.addListener(polygon,"mouseover",function(){
 this.setOptions({fillColor: "#00FF00"});
}); 

google.maps.event.addListener(polygon,"mouseout",function(){
 this.setOptions({fillColor: "#FF0000"});
});

这篇关于谷歌地图API V3鼠标悬停多边形?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆