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

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

问题描述

所以,我正在尝试添加谷歌地图到我的网页。我想在地图上点击标记时在弹出式气泡中添加表单。



API文档说明domready


事件在包含InfoWindow的内容附加到DOM时触发。如果要动态构建信息窗口内容,则可能希望监视此事件。


我如何听这个活动?

这是文档

解决方案

我自己也解决了类似的问题。要监听domready事件,请使用以下语法:

  infoWindow = new google.maps.InfoWindow(); 
google.maps.event.addListener(infoWindow,'domready',function(){
//一旦DOM准备好就可以做什么
});


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.

The API documentation says that the domready

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

How do I listen to this event?

This is the documentation.

解决方案

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天全站免登陆