点击Fusion Tables图层时,如何让这个脚本触发? [英] How do I make this script fire when I click a Fusion Tables layer?

查看:139
本文介绍了点击Fusion Tables图层时,如何让这个脚本触发?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的地图上有一张Fusion Table图层。我想做到这一点,当我点击Fusion Table图层时,这个脚本就会触发。



到目前为止我的代码:

  gmap = new google.maps.Map(document.getElementById(map-canvas)); 
google.maps.event.addListener(gmap,'click',function(e){
console.log(e);
}); // DONE:google.maps.event.addListener

当我点击一部分地图没有Fusion Table层,脚本触发。但是,如果我点击Fusion Table图层的一部分,它不会。



我该怎么做?

可点击选项设置为 false 或者观察点击 - FusionTablesLayer事件


I have a Fusion Table layer on my map. I want to make it so that when I click on the Fusion Table layer, this script fires.

My code so far:

gmap = new google.maps.Map(document.getElementById("map-canvas"));
google.maps.event.addListener(gmap,'click',function(e){
  console.log(e);
}); // DONE: google.maps.event.addListener

When I click a part of the map that has no Fusion Table layer on it, the script fires. But if I click a part of the Fusion Table layer, it doesn't.

What do I do?

解决方案

You must either set the clickable-option of the FusionTablesLayer to false or also observe the click-event of the FusionTablesLayer

这篇关于点击Fusion Tables图层时,如何让这个脚本触发?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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