How do I detect a click event on a google maps PolyLine overlay?
Posted
by Tom
on Stack Overflow
See other posts from Stack Overflow
or by Tom
Published on 2009-04-06T10:04:43Z
Indexed on
2010/04/06
12:53 UTC
Read the original article
Hit count: 214
google-maps
|JavaScript
It seems to me that I should be able to do the following to detect a click event on a line on a google map:
var line = new GPolyline( ... );
map.addOverlay(line);
GEvent.addListener(line, "click", function(latlng){ alert("clicked"); });
The api reference says this is available in version 2.88, which was released in 2007(!?), so I'm assuming that's what I'm using, but I don't know how to confirm that.
I also tried setting the {clickable:true}
option explicitly (it's supposed to be the default.) I've tested in FireFox 3 and Opera 9.6 so doubt it's browser specific. I'm also using jQuery on the page.
I have plenty of code detecting clicks on markers that works fine, clicking on lines would be really nice, can anyone enlighten me?
© Stack Overflow or respective owner