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));
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: