谷歌地图鼠标悬停事件

时间:2014-09-15 16:03:05

标签: google-maps mouseevent

我正在尝试让google.maps.event.addListener使用鼠标悬停我可以让它工作点击,但当我将其更改为鼠标悬停没有运气

这是代码的链接 http://jsfiddle.net/alabrahamson78/kj7h4L5c/

  var map;
  var layerl0;

  function initialize() {
      map = new google.maps.Map(document.getElementById('map-canvas'), {
          center: new google.maps.LatLng(40.54406827862351, -73.99465471093754),
          zoom: 7,
          mapTypeId: google.maps.MapTypeId.ROADMAP
      });
      layerl0 = new google.maps.FusionTablesLayer({
          suppressInfoWindows: true,
          query: {
              select: "col2",
              from: "1gVbSjc3mwdsBtaBgieFJ1T5mK_zBBXyYx8gQTFVi"
          },
          map: map,
          styleId: 2,
          templateId: 4
      });
      google.maps.event.addListener(layerl0, 'click', function (e) {
          document.getElementById('cards').src =
              'https://www.google.com/fusiontables/embedviz?viz=CARD&q=select+*+from+1gVbSjc3mwdsBtaBgieFJ1T5mK_zBBXyYx8gQTFVi+where+col0+%3D+' + e.row['Code'].value + '&tmplt=1&cpr=2';

          document.getElementById('card').src =
              'https://www.google.com/fusiontables/embedviz?viz=CARD&q=select+*+from+1gVbSjc3mwdsBtaBgieFJ1T5mK_zBBXyYx8gQTFVi+where+col0+%3D+' + e.row['Code'].value + '&tmplt=2&cpr=2';
      });
  }
  google.maps.event.addDomListener(window, 'load', initialize);

1 个答案:

答案 0 :(得分:1)

FusionTablesLayer不支持鼠标悬停事件(唯一支持的事件是“点击”)。您可以实现鼠标悬停类型功能,但它本身不受支持。有关示例,请参阅fusiontips