在重叠标记蜘蛛网上的InfowDindows
我使用的是Google Maps API V3,带有标记层和重叠标记蜘蛛网。它运行良好,但是我对每个标记附加的Infowdindows有一个问题。当指定一组标记并用键或鼠标打开InfowDOW,相对于标记的真实位置而不是蜘蛛状位置,InfowDindow的位置是定位的。有什么办法可以让InfowDindow跟随蜘蛛侠?
OMS指定:
var oms = new OverlappingMarkerSpiderfier(map, {
markersWontMove: true,
markersWontHide: true,
keepSpiderfied: true,
legWeight: 1
});
google.maps.event.addListener(marker, 'click', function(marker, e) {
return function() {
var myHTML = e.feature.getProperty('html');
boxText.innerHTML = '<div class="ib">' + myHTML + '</div>';
infowindow.setPosition(e.feature.getGeometry().get());
infowindow.setOptions({
pixelOffset: new google.maps.Size(0, -42)
});
infowindow.open(map);
};
}(marker, e));
https://jsfiddle.net/groxmzej/
I am using Google Maps API V3 with Marker Clusterer and Overlapping Marker Spiderfier. It is working quite well but I have an issue with the infowindows attached to each marker. When a group of markers are specified and an infowindow is opened with a click or mouseover, the infowindow is positioned relative to the true position of the marker and not the spiderfied position. Is there any way to get the infowindow to follow the spiderfier?
OMS is specified with:
var oms = new OverlappingMarkerSpiderfier(map, {
markersWontMove: true,
markersWontHide: true,
keepSpiderfied: true,
legWeight: 1
});
And the infowindows with:
google.maps.event.addListener(marker, 'click', function(marker, e) {
return function() {
var myHTML = e.feature.getProperty('html');
boxText.innerHTML = '<div class="ib">' + myHTML + '</div>';
infowindow.setPosition(e.feature.getGeometry().get());
infowindow.setOptions({
pixelOffset: new google.maps.Size(0, -42)
});
infowindow.open(map);
};
}(marker, e));
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在
infowdow
文档
因此,更改您的代码,该代码从:
<
a
a href = “ https://jsfiddle.net/geocodezip/geocodezip/nv0lc9x6/1/” =“ https://i.sstatic.net/5lthn.png” rel =“ nofollow noreferrer”>
代码段:
Use the marker reference as the "anchor" in the call to open on the
InfoWindow
documentation
So change your code that opens the infowindow from:
To:
proof of concept fiddle
code snippet: