当鼠标快速移动到左右两个标记上时,标记信息窗口的白色底部尖端会出现在地图的左上角。
在此处查看http://jsfiddle.net/WGy4g/3/
var map = null;
initialize();
function initialize() {
var mapOptions = {center: new google.maps.LatLng(-34.397, 150.644),zoom: 8};
map = new google.maps.Map(document.getElementById("map-canvas"), mapOptions);
addMarker(-34.397, 150.644);
addMarker(-34.377, 150.534);
}
function addMarker(lat,lng) {
var marker = new google.maps.Marker({position: new google.maps.LatLng(lat,lng), title: "marker"});
marker.setMap(map);
google.maps.event.addListener(marker, 'mouseover', function() {
if (!this.infowindow) {
this.infowindow = new google.maps.InfoWindow({content: 'abc'});
}
this.infowindow.open(map, this);
});
google.maps.event.addListener(marker, 'mouseout', function() {
this.infowindow.close();
});
}
发布了错误报告:https://code.google.com/p/gmaps-api-issues/issues/detail?id=6746&thanks=6746&ts=1401343988
答案 0 :(得分:1)
Google map js api version 3 infowindow glitch
可能重复我可以确认在IE和谷歌浏览器中都会发生这种情况。它似乎是Google Maps API的一个问题,因此您将此列为错误是正确的。为了尝试在我自己的一个脚本中解决问题,我尝试过;在调用打开方法之前,使用InfoWindow类的 setPosition 方法将特定的LatLng坐标设置为0,0;并通过 setOptions 方法摆弄 pixelOffset 属性,但无济于事。我还考虑过来回改变InfoWindow的可见性状态,但没有简单的方法。
等待修复错误似乎是唯一可行的选择。