Google Maps Api V3: click event firing twice

前端 未结 5 1277
鱼传尺愫
鱼传尺愫 2021-01-14 05:43

I am following the MVCObject binding example from this page:

http://code.google.com/apis/maps/articles/mvcfun.html

I want to change the color of the circle a

5条回答
  •  抹茶落季
    2021-01-14 06:15

    Do you have another click listener on the map? Try using mouseEvent.stop() so that it doesn't propagate to the map. documentation here

       google.maps.event.addListener(circle, 'click', function(mev) {
               mev.stop();
               alert('circle clicked'); 
       });
    

    It could be the line

     circle.bindTo('map', this);
    

    that causes it.

提交回复
热议问题