将事件监听器添加到infowindow Google Maps v3中 [英] Adding event listener to infowindow Google Maps v3

查看:80
本文介绍了将事件监听器添加到infowindow Google Maps v3中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试为信息窗口"添加一些侦听器,例如:

I tried to add some listeners for Info Window like:

//works
google.maps.event.addListener(markerInfoWindow, "closeclick", function()
{
    console.log('trigger close');
});

//doesn't work
google.maps.event.addListener(markerInfoWindow, "click", function()
{
    console.log('trigger close');
});

我错过的文档中是否有infoWindow的事件列表,或者有其他方法可以使事情完成?

Is there a list of events for infoWindow in documentation I missed or is there another way to make things done?

实际上,问题是我想创建一个事件侦听器以关闭mouseout

Actually the probles is that I want to create an event listener to close infoWindow on mouseout

google.maps.event.addListener(markerInfoWindow, 'mouseout', function(){
    console.log('trigger close');
    self._setInfoWndClosed();
});

self._setInfoWndClosed()closeclick事件的上下文中正常工作.最后,我发现听者实际上无法正常工作.

the self._setInfoWndClosed() is working correctly in context of closeclick event. And I end up finding out that actually listener doesn't work itself.

推荐答案

没有记录在案的点击";或鼠标悬停" InfoWindow事件:google.maps上唯一的记录的事件.InfoWindow (目前)是:

There is no documented "click" or "mouseover" event for an InfoWindow: The only documented events on an google.maps.InfoWindow (at present) are:

事件

closeclick 参数:无

单击关闭按钮时将触发此事件.

This event is fired when the close button was clicked.

content_changed 参数:无

content属性更改时将触发此事件.

This event is fired when the content property changes.

准备就绪参数:无

当包含InfoWindow的内容附加到DOM时,将引发此事件.如果您正在动态构建信息窗口内容,则可能希望监视此事件.

This event is fired when the containing the InfoWindow's content is attached to the DOM. You may wish to monitor this event if you are building out your info window content dynamically.

position_changed 参数:无

position属性更改时会触发此事件.

This event is fired when the position property changes.

zindex_changed 参数:无

当InfoWindow的zIndex更改时,会引发此事件.

This event is fired when the InfoWindow's zIndex changes.

您可以为点击"添加监听器.和鼠标悬停"信息窗口的内容上发生的事件.

You can add listeners for "click" and "mouseover" events on the content of the InfoWindow.

这篇关于将事件监听器添加到infowindow Google Maps v3中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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