我在“鼠标悬停”上有一个事件监听器,它可以在 infoWindow 中显示正确的文本,但是这些 infoWindow 永远不会消失,除非你按下 x。我希望它们在用户移开鼠标后消失。下面是代码。
谢谢!
iPark.makeMarker = function (lat, long, street, location, description ) {
var myLatlng = new google.maps.LatLng(lat, long)
var marker = new google.maps.Marker({
position: myLatlng,
title: 'Click to Zoom'
});
marker.setMap(this.map)
google.maps.event.addListener(marker, 'click', function() {
iPark.map.setZoom(18);
iPark.map.setCenter(marker.getPosition());
google.maps.event.addListener(marker, 'click', function() {
iPark.map.setZoom(13)
iPark.map.setCenter(37.7833, -122.4167)
})
});
google.maps.event.addListener(marker, 'mouseover', function() {
iPark.infoWindow(street).open(iPark.map, marker)
});
google.maps.event.addListener(marker, 'mouseout', function() {
console.log("hello")
iPark.closeinfoWindow
});
}
iPark.infoWindow = function(street){
return new google.maps.InfoWindow({
content: String(street)
})
iPark.closeinfoWindow = InfoWindow.close()
};