How do I monitor for clicks on polygons with Google Maps API v3

旧城冷巷雨未停 提交于 2020-01-24 20:23:04

问题


My polygons are loaded dynamically from a .kml file using KMLLayer.

I need these polygons (on click) to link to a page.

Can anyone advise me or provide a solution please?

Thanks!


回答1:


You can just simply add a listerer to the polygon.

var polygon = google.maps.Polygon(....);
polygon.addListener('click', function(){

});

Polygon reference




回答2:


If i'm not mistaken i think that features loaded from kml cannot have listeners attached to them.Please take a close look here



来源:https://stackoverflow.com/questions/5067534/how-do-i-monitor-for-clicks-on-polygons-with-google-maps-api-v3

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!