【发布时间】:2018-02-21 15:09:47
【问题描述】:
在 JS 中,当我将鼠标移出它时,我需要在标记上关闭 Infowindow,但是当鼠标悬停在 infowindow 上时,infowindow 不应该消失。因为如果信息窗口中有滚动,用户可以滚动它(我想成为那个)。
google.maps.event.addListener(marker, 'mouseover', (function (marker, content, infowindow) {
return function () {
if (content != null && content != "")
{
infowindow.setContent(content);
infowindow.open(map, marker);
if (marker.getAnimation() !== null) {
marker.setAnimation(null);
} else { marker.setAnimation(google.maps.Animation.BOUNCE);
console.log(content);
}
}
};
})(marker, content, infowindow));
google.maps.event.addListener(marker, 'mouseout', (function (marker, infowindow) {
return function () {
infowindow.close(map, marker);
if (marker.getAnimation() !== null) {
marker.setAnimation(null);
}
};
})(marker, infowindow));
【问题讨论】:
-
当您将鼠标悬停在或单击标记时,您希望信息窗口打开吗?
标签: javascript google-maps mouseevent marker infowindow