Javascript 使用Google Maps API 3单击多边形-需要更改为MouseOver(Geoxmlv3&;KML层)

Javascript 使用Google Maps API 3单击多边形-需要更改为MouseOver(Geoxmlv3&;KML层),javascript,google-maps,google-maps-api-3,kml,geoxml3,Javascript,Google Maps,Google Maps Api 3,Kml,Geoxml3,我有一个运行自定义KML(geoxml3)的GoogleMaps(API3),其中包含标题和描述的多边形 这一切都很好,但我需要改变多边形点击显示的信息窗口工作悬停代替。创建一个运行click函数的mouseover侦听器非常简单,但是我需要click来运行另一个函数,因此使用此方法可以覆盖click函数 如何查找/复制为多边形单击函数运行的代码,并将其应用于onmouseover?这可能吗 更新:我在geommlv3.js文件中找到了这个部分: google.maps.event.addLis

我有一个运行自定义KML(geoxml3)的GoogleMaps(API3),其中包含标题和描述的多边形

这一切都很好,但我需要改变多边形点击显示的信息窗口工作悬停代替。创建一个运行click函数的mouseover侦听器非常简单,但是我需要click来运行另一个函数,因此使用此方法可以覆盖click函数

如何查找/复制为多边形单击函数运行的代码,并将其应用于
onmouseover
?这可能吗

更新:我在
geommlv3.js
文件中找到了这个部分:

google.maps.event.addListener(gObj, 'click', function (e) {

    var iW = this.infoWindow;
    iW.close();
    iW.setOptions(this.infoWindowOptions);

    if (e && e.latLng) iW.setPosition(e.latLng);

    else if (this.bounds) iW.setPosition(this.bounds.getCenter());

    iW.setContent("<div id='geoxml3_infowindow'>" + iW.getContent() + "</div>");

    google.maps.event.addListenerOnce(iW, "domready", function () {

        var node = document.getElementById('geoxml3_infowindow');
        var imgArray = node.getElementsByTagName('img');

        for (var i = 0; i < imgArray.length; i++) {

            var imgUrlIE = imgArray[i].getAttribute("src");
            var imgUrl = cleanURL(doc.baseDir, imgUrlIE);

            if (kmzMetaData[imgUrl]) {
                imgArray[i].src = kmzMetaData[imgUrl].dataUrl;
            } else if (kmzMetaData[imgUrlIE]) {
                imgArray[i].src = kmzMetaData[imgUrlIE].dataUrl;
            }
        }
    });

    iW.open(this.map, this.bounds ? null : this);
});
google.maps.event.addListener(gObj,'click',函数(e){
var iW=this.infoWindow;
iW.close();
iW.setOptions(this.infoWindowOptions);
如果(e&e.latLng)iW.设置位置(e.latLng);
else if(this.bounds)iW.setPosition(this.bounds.getCenter());
setContent(“+iW.getContent()+”);
google.maps.event.addListenerOnce(iW,“domready”,函数(){
var node=document.getElementById('geoxml3_infowindow');
var imgArray=node.getElementsByTagName('img');
对于(变量i=0;i
我已尝试将“单击”事件更改为“
mouseover
”,但这不会导致
mouseover
或单击工作以下是解决方案(经过多次尝试和错误!)

google.maps.event.addListener(poly,“mouseover”,函数(e){
var iW=this.infoWindow;
iW.close();
iW.setOptions(this.infoWindowOptions);
如果(e&e.latLng)iW.设置位置(e.latLng);
else if(this.bounds)iW.setPosition(this.bounds.getCenter());
setContent(“+iW.getContent()+”);
iW.open(this.map,this.bounds?null:this);
});

然后把你的点击功能改成其他功能。记住也要设置mouseout函数来关闭信息窗口

它是geoxmlv3.js文件的一部分-我认为它是一个标记/多段线/多边形
google.maps.event.addListener(poly,"mouseover",function(e) {

  var iW = this.infoWindow;
  iW.close();
  iW.setOptions(this.infoWindowOptions);

  if      (e && e.latLng) iW.setPosition(e.latLng);
  else if (this.bounds)   iW.setPosition(this.bounds.getCenter());

  iW.setContent("<div id='geoxml3_infowindow'>"+iW.getContent()+"</div>");

  iW.open(this.map, this.bounds ? null : this);
});