在javascript中使鼠标移出时信息窗口消失
当光标移动到标记上时,我需要在其尖端显示标记的位置。 当我在标记上移动时,它会显示位置。当我离开时,信息窗口不会消失。这令人困惑。也许我的代码有问题。代码是:在javascript中使鼠标移出时信息窗口消失,javascript,html,Javascript,Html,当光标移动到标记上时,我需要在其尖端显示标记的位置。 当我在标记上移动时,它会显示位置。当我离开时,信息窗口不会消失。这令人困惑。也许我的代码有问题。代码是: function moveInfoWindow(marker, message) { var moveWindow = new google.maps.InfoWindow({ content: message }); google.maps.event.
function moveInfoWindow(marker, message) {
var moveWindow = new google.maps.InfoWindow({
content: message
});
google.maps.event.addListener(marker, 'mouseover', function() {
moveWindow.open(map, marker);
});
google.maps.event.addListener(marker, 'mouseout', function() {
moveWindow.close();
});
}
结果如下:
尝试如下更改代码:
google.maps.event.addListener(marker, 'mouseout', (function(infowindow){
return function() {
infowindow.close();
};
请在问题中添加代码。