Google map info block does not listen for click event

How to attach click event to goole map

+3
source share
1 answer

You need to create a marker and add a listener to it.

amarker = new google.maps.Marker(
           { position: alocations,
             map: map,
             title: "title " 
           } );
        google.maps.event.addListener(amarker, 'click', 
            function() {
              markerClick(this);
            }
        );
    }
    function markerClick( mark )
    {
       //do something
    }

You can follow the link for more information http://code.google.com/apis/maps/documentation/javascript/events.html

+1
source

Source: https://habr.com/ru/post/1796727/


All Articles