开发者

Adding click listener to Google Maps v3 Compass (navigation control)

开发者 https://www.devze.com 2023-01-07 20:48 出处:网络
I am trying to figure out how i can attach a click event to a google maps v3 compass. I have created a function that re-draws markers on a map and want this to be fir开发者_C百科ed when the user clic

I am trying to figure out how i can attach a click event to a google maps v3 compass.

I have created a function that re-draws markers on a map and want this to be fir开发者_C百科ed when the user click on the compass (arrows top left) of the google map.

I am working with google maps v3 and cant seem to find any way of doing this through the documentation.

Does anyone know how to do this?

Thanks in advance!


Click event of the compass is probably attached to the bounds_change event. Essentially, you are changing the bounds of the map.


You can listen to the center of the map changing:

google.maps.event.addListener(map, 'center_changed', function() {
   // Call your function to redraw markers here.
});
0

精彩评论

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

关注公众号