google maps v3 API 鼠标悬停在 GeoJson 多边形图层上

google maps v3 API mouseover with GeoJson polygon layer

如何使鼠标悬停事件与 google 地图 Api V3 多边形一起工作?

我无法在鼠标悬停时触发事件。

  var data_layer25 = new google.maps.Data({ map: map });
                                data_layer25.loadGeoJson('http://example.com/Assets/GeoJson/USA-MO.GeoJson');
                                data_layer25.setStyle({
                                            fillColor: '    #808000  ',
                                            strokeWeight: 1
                                    });
                                google.maps.event.addListener((data_layer25), "click", function () { window.location = "/RepTerritory/index/9" });
                    google.maps.event.addListener((data_layer25), "mouseover", function () {
                          this.setOptions({ fillColor: "#00FF00" });
                     });

                    google.maps.event.addListener((data_layer25), "mouseout", function () {
                          this.setOptions({ fillColor: "#FF0000" });
            });
            data_layer25.setMap(map);

尝试使用它来更改 Data Layers 在鼠标事件上的样式:

data_layer25.addListener('mouseover', function(e) {
     data_layer25.setStyle({
         fillColor: "#00FF00"
     });
});

data_layer25.addListener('mouseout', function(e) {
     data_layer25.setStyle({
         fillColor: "#FF0000"
     });
});