开发者

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

开发者 https://www.devze.com 2023-02-12 15:04 出处:网络
My polygons are loaded dynamically from a .kml file using KMLLayer. I need these polygons (on click) to link to a page.

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!


You can just simply add a listerer to the polygon.

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

});

Polygon reference


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

0

精彩评论

暂无评论...
验证码 换一张
取 消