eventsgoogle-maps-api-3infobubble

Google Maps API - Event Listener for InfoBubble doesn't work


I need an event listener waiting for a click. Unfortunately the way it worked with InfoWindows doesn't seem to work here...

Well, here's my InfoBubble:

var infoBubble = new InfoBubble({
      map: map,
      content: $('#my-div').html(),
      position: new google.maps.LatLng(areas[area].lat, areas[area].lng),
      shadowStyle: 1,
      padding: 0,
      borderRadius: 0,
      arrowSize: 10,
      borderWidth: 1,
      borderColor: '#ccc',
      disableAutoPan: true,
      hideCloseButton: true,
      arrowPosition: 15,
      arrowStyle: 0
    });

And here's my listener:

google.maps.event.addListener(infoBubble, 'click', function(){

        console.log("noodle");  
    });

BTW, there are no errors reported by Firebug.


Solution

  • Try this:

    $(infoBubble.bubble_).live("click", function() {
        console.log('clicked!');
    });