我注意到,当标记进入infobox时,cluster似乎没有消失。当标记进入群集时,有没有任何方法可以使信息框消失?如果没有,有关我将如何做的任何建议?我试图找出如何获得聚集的所有当前标记,但我没有运气。
每个标记都有一个专门为该标记制作的信息框。
感谢您提前给予的任何帮助!
地点数组示例:
var locations = [
['<div class="infomarkerdiv"><a href="index.php?p=JTLgRad15x8=&d=20150616041300"><div class="profile-pic-find" style="background-image: url(/bin/images/cars/2-1.jpg);"></div><div class="name"> Honda Civic</div></a></div>', 39.11342293092857, -77.8597175, 1, 2],
];
我的一些主要代码:
var marker, i;
var markers = new Array();
for (i = 0; i < locations.length; i++) {
marker = new google.maps.Marker({
position: new google.maps.LatLng(locations[i][1], locations[i][2]),
map: theMap
});
markers.push(marker);
var myOptions = {
content: locations[i][0],
boxClass: 'infobox',
closeBoxURL: "",
pane: "floatPane"
};
var ib = new InfoBox(myOptions);
ib.open(theMap, marker);
}
var markers = markers; //some array;
var bounds = new google.maps.LatLngBounds();
for (i = 0; i < markers.length; i++) {
bounds.extend(markers[i].getPosition());
}
theMap.fitBounds(bounds);
google.maps.event.addListener(marker, 'map_changed', function() {
//console.log(MarkerClusterer(getTotalMarkers()));
});
google.maps.event.addListener(marker, "click", function(e) {
ib.open(theMap, this);
});
var clusterStyles = [{
textColor: 'white',
url: 'http://google-maps-utility-library-v3.googlecode.com/svn/trunk/markerclusterer/images/m1.png',
height: 55,
width: 53
}, {
textColor: 'white',
url: 'http://google-maps-utility-library-v3.googlecode.com/svn/trunk/markerclusterer/images/m1.png',
height: 55,
width: 53
}, {
textColor: 'white',
url: 'http://google-maps-utility-library-v3.googlecode.com/svn/trunk/markerclusterer/images/m1.png',
height: 55,
width: 53
}];
var markerCluster = new MarkerClusterer(theMap, markers, mcOptions);