标签: openinfowindowhtml

谷歌地图:如何通过点击打开多边形的InfoWindow?

我有一个简单的问题,但我在Google Maps API文档中找不到答案...

我有一张由API绘制的13个多边形的地图.以下是其中一个多边形的示例:

 var zone_up_montblanc = new GPolygon([
        new GLatLng(46.21270329318585, 6.134903900311617), 
        new GLatLng(46.20538443787925, 6.136844716370282), 
        new GLatLng(46.20525043957647, 6.141375978638086), 
        new GLatLng(46.20698751554006, 6.148050266912262), 
        new GLatLng(46.21110286985207, 6.153203229026629), 
        new GLatLng(46.21730757985668, 6.151718301267355), 
        new GLatLng(46.22092122197341, 6.153676364285801), 
        new GLatLng(46.22615123408969, 6.149844858907489), 
        new GLatLng(46.22851200024137, 6.149876939987202), 
        new GLatLng(46.22945159836955, 6.142758190170017), 
        new GLatLng(46.21735908463437, 6.141457132705133), 
        new GLatLng(46.21753573755057, 6.138058122426195), 
        new GLatLng(46.21270329318585, 6.134903900311617)
        ], "#6b1f43", 2, 0.9, "#92c87f", 0.5);
Run Code Online (Sandbox Code Playgroud)

然后 :

  map.addOverlay(zone_up_montblanc);
Run Code Online (Sandbox Code Playgroud)

多边形出现在我的地图上,没问题.但我现在要做的就是通过点击每个多边形打开一个"InfoWindow"(每个多边形的内容不同).

有人有想法或榜样吗?

非常感谢你的帮助 !

google-maps polygon click openinfowindowhtml infowindow

10
推荐指数
2
解决办法
1万
查看次数

使用jQuery fadeIn和fadeOut的Google Maps API V3 InfoBox

我在网上搜索得很高,并且无法找到使用jQuery来淡化Google地图中的InfoBox/InfoWindow而不是实际框/窗口内容的教程或示例.这是我的代码,我不确定我做错了什么,但似乎也不对.

google.maps.event.addListener(marker, 'mouseover', function() {
    ib.setContent(html);
    ib.open(map, marker);
    ib.setValues({type: "point", id: 2})

   var idName = marker.get("id"); //I was trying to the id's of the elements here 
   var boxName = ib.get("id");    //to use in my jQuery

   jQuery(idName ).mouseover(function() {
      jQuery(boxName ).fadeIn('slow', function() {
    // Animation complete
   });
  });

});
Run Code Online (Sandbox Code Playgroud)

jquery google-maps fade openinfowindowhtml infowindow

8
推荐指数
2
解决办法
8390
查看次数