简体   繁体   English

谷歌地图addListener无法正常工作

[英]google maps addListener not working properly

i have a separate code for google maps v3. 我有一个单独的Google Maps v3代码。 Just for show infowindow infobox in my google fusion kml layer when i click on it. 当我单击它时,仅在我的Google Fusion KML图层中显示信息窗口信息框。 Yesterday my code is work fine. 昨天我的代码运行正常。 i didn't make any change. 我没有做任何改变。 but today my addListner not working. 但是今天我的addListner无法正常工作。 when i copy my back up project, same as code. 当我复制备份项目时,与代码相同。 it work again but tomorrow that happens again. 它再次工作,但明天又会发生。 My addListener not work. 我的addListener无法正常工作。

here's my code 这是我的代码

infoBubble = new InfoBubble({
  map: map,
  shadowStyle: 1,
  padding: 5,
  borderRadius: 4,
  arrowSize: 20,
  borderWidth: 1,
  borderColor: '#2c2c2c',
  disableAutoPan: true,
  hideCloseButton: false,
  backgroundClassName: 'phoney',
  arrowStyle: 2,
});

function get_details(mode,id,lati,lng)
  {
     $('#loading').show();
        if (xhr != null)
        {
           xhr.abort();
        }
        xhr = $.ajax({
           type: "GET",
            url: "realisasi2.php?id="+id,
           data: "m="+mode+"&id="+id,
           success: function(ret){
                ajaxres = JSON.parse(ret);
                iconpos = new google.maps.LatLng(lati,lng);
                psbchurndata = ajaxres.detail;
                var html = psbchurndata+"<i><a class='ajax' href='#' onclick=layer22("+id+","+lati+","+lng+") style='font-family: Arial;font-size: 12px; color:#00CC29;'>Lihat Datel </a></i>";
                infoBubble.setContent('<div class="infowindow"><br />'+html+'</div>');
                infoBubble.setPosition(iconpos);
                infoBubble.close();
                infoBubble.open(map);
                 $('#loading').hide();
           }
         });
  }


layer.setMap(map);   
google.maps.event.addListener(layer, 'click', function(e) { 

alert(JSON.stringify(e, null, 4)); //UNDIFINED not Working

  var lati = e.latLng['mb'];  
  var lng = e.latLng['nb'];  
  var x = e.row['id_witel'].value;
  get_details('w',e.row['id_witel'].value,lati,lng);    
});


}

thank's for any help 谢谢你的帮助

There are no "official" properties mb and nb for a google.maps.LatLng (that's what e.latLng is) . google.maps.LatLng (即e.latLng是什么)没有“正式”属性mbnb These properties will be used internally by the API, the names of these properties may change the next moment, hour or day. 这些属性将由API在内部使用,这些属性的名称可能会在下一个小时,小时或天更改。

To retrieve latitude and longitude use the methods lat() and lng() of e.latLng 要获取经度和纬度,请使用e.latLng lat()lng() e.latLng

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM