【发布时间】:2012-07-22 21:11:02
【问题描述】:
好的,我在 Google 地图中使用 infoBubble 弹出窗口 (http://google-maps-utility-library-v3.googlecode.com/svn/trunk/infobubble/examples/example.html/)。它类似于 infoWindow,但有一点可定制的。我稍微更改了库并给了气泡一个 ID (#infoBubble),希望使用 jQuery 来操作它。但似乎我无法选择它。可以使用 jQuery 选择包含地图的 DIV,但不能选择其中的任何元素。谁能帮我解决这个问题?
我正在尝试从通常的 $(document).ready(function() {}
中访问 infoBubble div更新:从 geocodezip 的回复中得知在 infoBubble 中创建的 div 不是 DOM 的一部分后,我添加了一个监听器事件,如下所示:
google.maps.event.addListener(infoBubble, "domready", function( {
$j('#infoBubble').click(function(){alert('bubble clicked');});
});
现在它正在到达某个地方。这行得通。虽然我遇到了问题,因为有很多 infoBubble 弹出窗口,但如果我遇到一些问题,我会编辑这个问题。到目前为止,这是可行的。
【问题讨论】:
-
您何时尝试访问 infoBubble 中的 div?它是否附加到 DOM 并且可见?
-
嗨 geocodezip,我更新了我的问题。
标签: google-maps google-maps-api-3 infowindow