Anexar o manipulador de eventos ao elemento dentro da bolha de informações do Google Maps
Eu tenho uma pergunta sobre o google maps e manipulação de eventos / escuta.
Usando jQuery e google maps v3, eu posso colocar um marcador de mapa e um ouvinte de evento que abre uma infobubble quando o usuário clica no marcador. O que eu gostaria de fazer (mas até agora não consegui descobrir) é adicionar outro manipulador de eventos ao conteúdo da bolha de informações. Por exemplo, se o usuário clicar no marcador de mapa, abra a bolha de informações (essa parte funciona) e, em seguida, se clicar em algo dentro da infobubble, faça outra coisa. Eu colei meu código abaixo, obrigado antecipadamente por qualquer ajuda
<code>function addMarker(data) { var myLatlng = new google.maps.LatLng(data.Latitude, data.Longitude); var title = data.title? data.title: ""; var icon = $('#siteUrl').val() + 'img/locate.png'; var bubbleContentString = "<span class=\"bubble-details-button\">Get Details about " + title+ "</span>"; myInfoBubble = new InfoBubble({ content: bubbleContentString, hideCloseButton: true, backgroundColor: '#004475', borderColor: '#004475' }); var myMarker = new google.maps.Marker({ position: myLatlng, map: map, title: title, icon: icon }); addListenerToMarker(myMarker, myInfoBubble); markerSet.push(myMarker, myInfoBubble); } function addListenerToMarker(marker, bubble){ console.log($(bubble.getContent()).find('.bubble-details-button')[0]); google.maps.event.addListener(marker, 'click', function() { if (!bubble.isOpen()) { google.maps.event.addListenerOnce(bubble, 'domready', function(){ console.log($(bubble.getContent()).find('.bubble-details-button')[0]); google.maps.event.addDomListener($(bubble.getContent()).find('.bubble-details-button')[0], 'click', function(){ alert("hi"); }); }); bubble.open(map, marker); } }); } </code>