1
我的應用程序中有以下代碼,所有標記都添加到一個組中。我希望在加載地圖時,羣集中未摺疊的標記彈出窗口顯示它們的彈出窗口。 (標記,其是羣集的一部分,但不折疊成集羣上的特定縮放級別,當映射在該縮放等級加載)傳單markercluster加載時打開彈出框
var markers = [{
"latLong": [57.67, -3.89]
},
{
"latLong": [-4.4, -58.34]
},
{
"latLong": [35.79, 139.48]
}],
markerGroup = L.markerClusterGroup(),
marker;
markers.forEach(function (markerConfig, index) {
marker = new L.Marker(new L.LatLng(markerConfig.latLong[0], markerConfig.latLong[1]));
marker.bindPopup(index, {
"autoClose": false,
"closeOnClick": false
}).openPopup();
markerGroup.addLayer(marker);
});
clusterMap.addLayer(markerGroup);
我想上標記的openPopup()方法,以打開彈出當加載地圖時,它會在點擊標記時打開。請幫忙。