Open the Google Maps info window by clicking on an external map

I understand how addListener works inside the map itself, but how can I get an info window to open when I click an item outside the map? For example, div with id #test?

+3
source share
1 answer

Attach an event listener to the element you are clicking on. For instance. with jQuery :

$("#test").click(function(){
   yourInfoWindow.open(yourMap);
});

You need links to the info window you want to open and to the Google Map object. See the API link and examples .

-1
source

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


All Articles