Google Maps API - InfoBubble的事件侦听器不起作用 [英] Google Maps API - Event Listener for InfoBubble doesn't work

查看:161
本文介绍了Google Maps API - InfoBubble的事件侦听器不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要一个等待点击的事件监听器。不幸的是,它与 InfoWindows 的工作方式似乎不在这里...

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

嗯,这是我的 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
    });

这里是我的监听器:

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

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

BTW,Firebug没有报告错误。

BTW, there are no errors reported by Firebug.

推荐答案

尝试这样:

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

这篇关于Google Maps API - InfoBubble的事件侦听器不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆