是否可以检测到Google Maps信息窗口内的点击?
var contentString = '<div id="content"><a href='#' data-id='click'>test</a></div>';
var infowindow = new google.maps.InfoWindow({
content: contentString
});
答案 0 :(得分:0)
如何:
click
处理程序附加到正文Node.contains()
确定是否单击了信息窗口节点例如:
document.body.addEventListener("click", function(event) {
var anchor = document.querySelector('a[data-id="click"]');
if (anchor && anchor.contains(event.target)) {
console.log("Info window is clicked..");
}
});