gachseang / google-maps-utility-library-v3

Automatically exported from code.google.com/p/google-maps-utility-library-v3
0 stars 0 forks source link

infobubble - can't bind click even with live inside the box #111

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
put the content as:
<div class="click-me"></div>

assuming var infobubble is the infobubble:

$('.click-me').live('click', function()
{
  infobubble.close();
});

this does not respond at all. there is only one infobubble.

Original issue reported on code.google.com by krom...@gmail.com on 25 Jul 2011 at 6:34

GoogleCodeExporter commented 8 years ago
I'm having same issue, seems the function InfoBubble.prototype.addEvents_ is 
canceling all events.  If i temporarily remove the 'click' from the event array 
in th e function, then my click event works.  This function should be modified 
to be remove events a little more intelligently.

[code]
/**
 * Add events to stop propagation
 * @private
 */
InfoBubble.prototype.addEvents_ = function() {
  // We want to cancel all the events so they do not go to the map
  var events = ['mousedown', 'mousemove', 'mouseover', 'mouseout', 'mouseup',
      'mousewheel', 'DOMMouseScroll', 'touchstart', 'touchend', 'touchmove',
      'dblclick', 'contextmenu', 'click'];

  var bubble = this.bubble_;
  this.listeners_ = [];
  for (var i = 0, event; event = events[i]; i++) {
    this.listeners_.push(
      google.maps.event.addDomListener(bubble, event, function(e) {
        e.cancelBubble = true;
        if (e.stopPropagation) {
          e.stopPropagation();
        }
      })
    );
  }
};
[/code]

Original comment by da...@meshnet.ca on 25 Jul 2011 at 12:59

GoogleCodeExporter commented 8 years ago
Note that the implementation should be where you disable the regular map 
functions (the drag/double click zoom, etc) don't work, but the custom binds 
still do work (the coder who is binding the click/whatever).

Original comment by *...@wepay.com on 25 Jul 2011 at 4:40