为 google.maps.InfoWindow 类监听 domready 事件 [英] Listening for the domready event for google.maps.InfoWindow class

查看:20
本文介绍了为 google.maps.InfoWindow 类监听 domready 事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以,我想在我的网页上添加一个谷歌地图.当您点击地图上的标记时,我想在弹出的气泡中添加一个表单.

So, I am trying to make add a google map to my webpage. I want to add a form into the pop-up bubble when you click on a marker on the map.

API 文档说 domready

The API documentation says that the domready

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

"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."

我如何收听此事件?

这是文档.>

推荐答案

我刚刚自己解决了一个类似的问题.要侦听 domready 事件,请使用以下语法:

I just solved a similar problem myself. To listen for the domready event, use the following syntax:

infoWindow = new google.maps.InfoWindow();
google.maps.event.addListener(infoWindow, 'domready', function() {
      // whatever you want to do once the DOM is ready
});

这篇关于为 google.maps.InfoWindow 类监听 domready 事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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