点击GoogleMap InfoWindow中的事件 [英] Click event inside GoogleMap InfoWindow

查看:332
本文介绍了点击GoogleMap InfoWindow中的事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望在信息窗口和infowindow中的按钮中显示googlemap位置详细信息,以便在单击该按钮后显示新的QMainwindow。

I want to display googlemap location details in a info window and a button inside the infowindow, so that after clicking that button, a new QMainwindow will display.

在此时我只能用关闭按钮显示默认infowindow。

At this point of time I am only able to show the default infowindow with close button.

是否可以在infowindow中添加可点击事件。

Is it possible to add a clickable event inside the infowindow.

推荐答案

您可以将InfoWindow的内容设置为DOM Node

You can set the content of an InfoWindow to be a DOM Node.

例如,类似这样的内容:

For example, something like this:

var infoWindow = new google.maps.InfoWindow();
var content = document.createElement('button');

google.maps.event.addDomListener(content, 'click', function() {
  // open QMainwindow
});

infoWindow.open(map);

这篇关于点击GoogleMap InfoWindow中的事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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